Hello,
Would somebody be kind enough to provide me with a cron script using a lock file for updating via rsync. I'd rather not have to reinvent the wheel...
Thanks!
-David
Have a look at these, modify as appropriate.
-Brian
David Stanford wrote:
Hello,
Would somebody be kind enough to provide me with a cron script using a lock file for updating via rsync. I'd rather not have to reinvent the wheel...
Thanks!
-David
CentOS-mirror mailing list CentOS-mirror@centos.org http://lists.centos.org/mailman/listinfo/centos-mirror
Here is a complete amateur's effort:
#!/bin/bash if [ -f /root/rsync-scripts/centos.lockfile ] then #echo "lock file exists, exiting..." exit fi #echo "creating lock file..." touch /root/rsync-scripts/centos.lockfile rsync -aqzH --partial --delete us-msync.centos.org::CentOS /home/ftp/pub/CentOS #echo "this is where rsync is" rm -f /root/rsync-scripts/centos.lockfile
Obviously, the echos were there when i was testing it.
~Will
David Stanford wrote:
Hello,
Would somebody be kind enough to provide me with a cron script using a lock file for updating via rsync. I'd rather not have to reinvent the wheel...
Thanks!
-David
[root@fbsd ~]# fortune Happiness is just an illusion, filled with sadness and confusion.
CentOS-mirror mailing list CentOS-mirror@centos.org http://lists.centos.org/mailman/listinfo/centos-mirror
On Mon, Dec 18, 2006 at 11:15:46AM -0500, William Dunn wrote:
if [ -f /root/rsync-scripts/centos.lockfile ]
[...]
touch /root/rsync-scripts/centos.lockfile
I suggest using mkdir for lockfiles -- if the directory already exists, it'll fail, so you can do the test and create as essential an atomic operation, so you don't have a race.
Thanks everyone, I got.
-David