rdiff-backup-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [rdiff-backup-users] locking the rdiff-backup destination


From: Dominic Raferd
Subject: Re: [rdiff-backup-users] locking the rdiff-backup destination
Date: Thu, 24 Dec 2009 10:06:14 +0000
User-agent: Thunderbird 2.0.0.23 (Windows/20090812)

Jakob Unterwurzacher wrote:
I guess you will have to use a wrapper script for your rsync job and your rdiff-backup job that does the locking (and obeys the lock).

If you start both jobs at the same machine, it's easy:
Put this at the start of each script - it will then exit when another instance is running.

#####

#!/bin/bash

exec 200> /tmp/lockfileXYZ
flock -n 200 || echo 'Could not get lock!' && exit 1

#####
Nice tip! An alternative which doesn't require flock or a temporary lock file is (again for a bash script):

######
#!/bin/bash

[ -n "`ps h -C rdiff-backup`" ] && echo "`basename $0` aborting - rdiff-backup is running" && exit 1

######

Dominic




reply via email to

[Prev in Thread] Current Thread [Next in Thread]