|
Can is set permissions temporarily?
I want to do just what the title says. Here's why:
I am adapting a script that backups to a mount. In the script it has a catch where if the drive isn't RW then it unmounts and attempts to remount RW.
# attempt to remount the RW mount point as RW; else abort
$MOUNT -o remount,rw $MOUNT_DEVICE $SNAPSHOT_RW ;
if (( $? )); then
{
$ECHO "snapshot: could not remount $SNAPSHOT_RW readwrite";
exit;
}
fi;
I want to backup to another directory on the same drive, but i want that directories normal everyday permissions to be read only except for when i run the backup script. Is there a way to say "while this script runs apply these permissions to this directory? without simply chmoding at the front and backends of the script?
Suggestions are welcome.
Thanks,
Movomito
|