The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to block a user temporarily? winky AIX 3 06-19-2007 10:27 AM
fork: Resource temporarily unavailable - What can I check ? unclefab SUN Solaris 5 04-12-2007 02:22 PM
Temporarily disable effect of set -e in ksh ugeek Shell Programming and Scripting 1 03-28-2007 04:21 AM
Temporarily Disable User Account scotbuff HP-UX 4 01-26-2007 04:01 AM
temporarily stop cron services legato UNIX for Dummies Questions & Answers 1 12-31-2004 05:50 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-16-2008
Movomito Movomito is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 27
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
  #2 (permalink)  
Old 05-16-2008
fabtagon fabtagon is offline
Registered User
  
 

Join Date: Apr 2008
Location: European Union/Germany
Posts: 189
Quote:
Originally Posted by Movomito View Post
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.
You're a bit hard to understand (among others your use of genitive is improper).

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?
  #3 (permalink)  
Old 05-16-2008
Movomito Movomito is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 27
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.
  #4 (permalink)  
Old 05-16-2008
fabtagon fabtagon is offline
Registered User
  
 

Join Date: Apr 2008
Location: European Union/Germany
Posts: 189
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:
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
Which permissions? Those of the actual data!? Aren't they rw already?

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.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:32 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0