Jason

We use a check in the bash script that runs rdiffbackup. This puts a pid file into the var run directory and causes the script to block if the script has not cleared it at the end.

if test -e /var/run/remotebackup.pid; then
 echo "Backup is already running!"
 echo "If it isn't, remove /var/run/backup.pid and try again."
 exit 0;
else
 echo $$ > /var/run/remotebackup.pid;
fi

...do the work here

# Remove lock file and end script
#
if test -e /var/run/remotebackup.pid; then
 rm /var/run/remotebackup.pid;
 else
 echo "Could not remove lock file!" >> $LOGFILE
fi

Peter Howell



Jason L. Buberel wrote:
On my backup server I use rdiff-backup to remotely backup several rather large postgres database installations (using the postgres hot-backup capability). Under certain circumstances, these backups can take a very long time to complete.

The execution of these backups is scheduled via cron.

And when they take a very, very long time they can start to overlap. When this happens, I get an error message from rdiff-backup:

Fatal Error: It appears that a previous rdiff-backup session with process
id 21022 is still running.  If two different rdiff-backup processes write
the same repository simultaneously, data corruption will probably
result.  To proceed with regress anyway, rerun rdiff-backup with the
--force option.
Fatal Error: Lost connection to the remote system

I would like to write a small script called 'exit-if-already-running.sh' that 
takes the name of an rdiff-backup directory (the directory containing the 
directory named 'rdiff-backup'), and exits with return code 1 if a back is 
already in progress. That would allow me to use it as such:

10 5 * * * root /usr/local/bin/exit-if-already-running.sh /backup/srv1 && 
/usr/bin/rdiff-backup srv1::/remote-dir /backup/srv1

What is the most reliable method to determine if rdiff-backup is already 
running on the destination directory?

Thanks,
Jason
------------------------------------------------------------------------

_______________________________________________
rdiff-backup-users mailing list at rdiff-backup-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/rdiff-backup-users
Wiki URL: http://rdiff-backup.solutionsfirst.com.au/index.php/RdiffBackupWiki


---
TEAM Consultants are now accredited by the Carbon Trust to provide free 
Solutions Development services in the following areas:
Energy Management, Strategy / Policy, Staff Training / Motivation, Monitoring & 
Targeting, Metering. Please email for details, [EMAIL PROTECTED]

Public sector organisations can appoint TEAM Energy Bureau and Consultancy 
services under the OGCbuying.solutions framework agreement, avoiding the need 
to go through a tendering process and saving as many as 77 days. Contact TEAM 
to find out more.

Registered Office: 34 The Forum, Rockingham Drive, Linford Wood, Milton Keynes 
MK14 6LY. Registered in England No. 1916768




_______________________________________________
rdiff-backup-users mailing list at rdiff-backup-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/rdiff-backup-users
Wiki URL: http://rdiff-backup.solutionsfirst.com.au/index.php/RdiffBackupWiki

Reply via email to