delay shutdown while backup (rsnapshot) is running
Hi,
I am using rsnapshot, together with run-rsnapshot and cron on my laptop.
This works perfectly fine as long as I don't decide to shutdown during a
backup. Unfortunately, on shutdown, rsnapshot gets terminated/killed,
which leaves the backup in an inconsistent state. For example this might
look like this:
[21/Jun/2010:00:00:02] /usr/bin/rsnapshot hourly: started
[21/Jun/2010:00:00:02] echo 15150 > /var/run/rsnapshot.pid
[21/Jun/2010:00:00:02]
mv /media/backup/hourly.5/ /media/backup/_delete.15150/
[21/Jun/2010:00:00:02]
mv /media/backup/hourly.4/ /media/backup/hourly.5/
[21/Jun/2010:00:00:02]
mv /media/backup/hourly.3/ /media/backup/hourly.4/
[21/Jun/2010:00:00:02]
mv /media/backup/hourly.2/ /media/backup/hourly.3/
[21/Jun/2010:00:00:02]
mv /media/backup/hourly.1/ /media/backup/hourly.2/
[21/Jun/2010:00:00:02] /bin/cp
-al /media/backup/hourly.0 /media/backup/hourly.1
[21/Jun/2010:00:12:49] /usr/bin/rsnapshot hourly: ERROR: rsnapshot was
sent TERM signal... cleaning up
[21/Jun/2010:00:12:50] rm -f /var/run/rsnapshot.pid
As you can see, this has two effects: first, the old backup gets not
deleted (which is hardly a problem), but more important, the new backup
and the previous one are incorrect.
Now my question: How can I prevent/delay the shutdown while rsnapshot is
running. For your information, I am using gnome, so a solution working
only for shutdowns via gnome system menu would be sufficient.
Ideally I would like the shutdown continue after rsnapshot is finished.
$ uname -a
Linux fkmobil 2.6.30-2-686 #1 SMP Fri Dec 4 00:53:20 UTC 2009 i686
GNU/Linux
gnome version should be 2.30
$ cat /etc/debian_version
squeeze/sid
Thanks, Fabian
--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 1278011472.4633.11.camel@localhost">http://lists.debian.org/1278011472.4633.11.camel@localhost
07-05-2010, 03:44 PM
André Berger
delay shutdown while backup (rsnapshot) is running
* Fabian Kürten (2010-07-01):
[...]
> Now my question: How can I prevent/delay the shutdown while rsnapshot is
> running. For your information, I am using gnome, so a solution working
> only for shutdowns via gnome system menu would be sufficient.
How does that system work?
You could run a shell script that checks for the rsnapshot process or
PID file. The script could either quit or loop when this is the case.
#detect rsnapshot process and exit
pidof rsnapshot && echo "Shutdown cancelled" || shutdown -h now
#alternatively, use the PID file, and loop in a 10 min. interval
[ ! -e /var/run/rsnapshot.pid ] && RSNAPSHOT="0" || RSNAPSHOT="1"
while [ "${RSNAPSHOT}" == "1" ] ; do
[ ! -e /var/run/rsnapshot.pid ] && RSNAPSHOT="0" && break || sleep 600
done
shutdown -h now
---------snap------------
-André
--
May as well be hung for a sheep as a lamb!
Linkstation/KuroBox/HG/HS/Tera Kernel 2.6/PPC from <http://hvkls.dyndns.org>
iPhone <http://hvkls.dyndns.org/downloads/documentation/README-iphone.html>
--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20100705154430.GB15613@fuchs">http://lists.debian.org/20100705154430.GB15613@fuchs