![]() |
|
|
|
|
|||||||
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. Shell Script Page. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to block a user temporarily? | winky | AIX | 3 | 06-19-2007 07:27 AM |
| fork: Resource temporarily unavailable - What can I check ? | unclefab | SUN Solaris | 5 | 04-12-2007 11:22 AM |
| Temporarily disable effect of set -e in ksh | ugeek | Shell Programming and Scripting | 1 | 03-28-2007 01:21 AM |
| Temporarily Disable User Account | scotbuff | HP-UX | 4 | 01-26-2007 12:01 AM |
| temporarily stop cron services | legato | UNIX for Dummies Questions & Answers | 1 | 12-31-2004 01:50 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
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 |
| Forum Sponsor | ||
|
|
|
|||
|
Quote:
How I understand you: i) you have a media which is mount ro ii) you want to backup to it iii) you therefore want to set only one dir of that drive to be writeable That is not possible. In order to write to that device you need to mount it rw. Why don't you simply mount it rw? |
|
|||
|
sorry... perhaps i was unclear.
I want to backup one directory to another on the same drive. I don't want to use mount at all. The script that i am adapting uses mount in the section that i made in blue in the original post. The function of that section was to ensure that the device being used to backup to (in the script that i am adapting from) was mounted Read Write, and then at the end they unmount Read Only. I didn't describe this very well in my previous post. But i am not trying to backup to an external device. Instead, i am simply backing up to another directory on the same file system (i am aware of the risks involved with this, it is on a Raid array using raid 5). The file system that i am backing up is huge and making it inaccessible to other users while the backup takes place is not really an option. So i would like to temporarily set the permissions to READ WRITE while the backup takes place, but when it is finished leave the backup directory as READ only. If i use chmod on the whole thing it will take forever, or at least that much longer. I would like to avoid having to do this. My hope, and reason for posting, is that there is a way to invoke permissions only during the actual backup process. I hope this provides a little clarification. Thanks. |
|
|||
|
Quite likely you are going to do something that will hurt you in the future.
Maybe it's best not to use that script which does not seem to fit your task. Is it maybe easier to use e.g. rsync? (and that tool can also backup very efficiently over network, if desired. I do use it to (in place, incrementally) backup about 70 GB over a 1 mbit line) [code]rsync /actual/data /backup/data --chmod=mode[/quote] However: That remount rw should not affect your running operations. A remount ro is likely to fail or hurt you - comment it out. Quote:
Why do you want the backup'd data to be ro? First that's no real security, second it will prevent you from fast recovery in case of data loss. If your script does not really care about permissions you can try to invoke umask (see man page) with some restrictive mask before running that script. |
|||
| Google UNIX.COM |
| Thread Tools | |
| Display Modes | |
|
|