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

Re: 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
shutdown -h now


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>

Reply to: