[TriLUG] creating a lock file

Joseph Tate jtate at dragonstrider.com
Wed Jul 9 16:09:48 EDT 2003


Wrap your rsync commands in shell scripts.  Then use touch <FILENAME> to 
create a file.  Use a structure like
if [-f <FILENAME> ] then
    exit;
fi
to test to see if it exists, then use rm <FILENAME> to remove the lock 
file.  Just create a file.  If it exists, exit, if not, continue, and 
remove it when you're finished.  I don't think there's a special "lock 
file create, check, remove" command series.

JoJo Almario wrote:

> Every now and then someone puts a huge unwieldy file on the file 
> server. My rsync backup runs into it and sometimes just halts on it.  
> This will either cause other rsync scripts to run into it or it just 
> halts there trying to copy it over, then I have a bunch of unfinished 
> rsync processes runnning in the background.
>
> How do I create a lock file when this happens and how can I get the 
> other rsync scripts to not run if there is a lock file present in a 
> previous process?
>




More information about the TriLUG mailing list