Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Since shutdowns during rsnapshot operation will lead to inconsistent/partial backups, I wonder how to delay the system shutdown while rsnapshot is active.

The task is complicated by the fact that I need a solution which is compatible with non-expert users i.e. I need to tell reliably to the user that he needs to wait until the process is finished and not to do a hard reset. Once this is the case shutdown should continue.

A possible solution could be to replace the action of the window managers (mostly KDE) shutdown/restart/hibernate buttons by a script which first checks if rsync is active and shows a message if this is the case. But I do not know if this is possible in KDE.

share|improve this question

Try making a script to enable and disable shutdown then move the executable elsewhere then in its place put a script that:

  1. Disables shutdown
  2. Runs the program
  3. Enables shutdown

See How to disable shutdown/reboot/suspend/hibernate?.

share|improve this answer
I understand that obviously /etc/polkit-1/50-local.d/disable-shutdown.pkla would disable the shutdown e.g. but which executables/scripts are called when I press the KDE shutdown button. I need to know this in order to replace it with my version. – highsciguy Sep 24 '12 at 16:40
But if you disable it then the KDE shutdown won't work either. Then just re-enable it afterwards as I have said above. – spudowiar Sep 24 '12 at 16:58
On my system creating /etc/polkit-1/50-local.d/disable-shutdown.pkla does actually not prevent shutdown. Probably because of this: . This should exclude this method unfortunately. – highsciguy Sep 24 '12 at 19:51
I shall go and ask Google for some help. – spudowiar Sep 24 '12 at 19:56
Do you have a /etc/shutdown.allow ? – spudowiar Sep 24 '12 at 20:04

I recently solved a similar problem, see

adapted to your questions the answer would be:

Create a file /etc/pm/sleep.d/00-check-rsnapshot. In this file check if a rsnapshot currently is active. If yes, just abort the script using exit 1. That's it. Suspend will be aborted.

Might work for shutdown, too.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.