2

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.

Anwar
  • 75,875
  • 31
  • 191
  • 309
highsciguy
  • 819
  • 2
  • 13
  • 23

2 Answers2

1

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?.

  • 2
    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. –  Sep 24 '12 at 16:58
  • 2
    On my system creating /etc/polkit-1/50-local.d/disable-shutdown.pkla does actually not prevent shutdown. Probably because of this: https://bugs.kde.org/show_bug.cgi?id=294714 . This should exclude this method unfortunately. – highsciguy Sep 24 '12 at 19:51
  • I shall go and ask Google for some help. –  Sep 24 '12 at 19:56
  • Do you have a `/etc/shutdown.allow` ? –  Sep 24 '12 at 20:04
  • No, I don't have it. – highsciguy Sep 24 '12 at 20:45
  • let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/5928/discussion-between-acematrix-and-highsciguy) –  Sep 25 '12 at 05:47
  • I didn't find time for chat this week unfortunately. Did you have further hints? – highsciguy Sep 30 '12 at 11:24
  • I didn't choose continue in chat, it was automatic –  Oct 05 '12 at 19:15
  • Other that kill KDE whilst snapshotting, no. –  Oct 05 '12 at 19:16
0

I recently solved a similar problem, see https://askubuntu.com/a/617395/368069

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.

JPT
  • 369
  • 1
  • 3
  • 14