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

Reply via email to