Alex Rivera | Logout

Temporarily prevent linux from shutting down

Asked 2008-11-26T21:39:48.307
14

I have a backup script that runs in the background daily on my linux (Fedora 9) computer. If the computer is shut down while the backup is in progress the backup may be damaged so I would like to write a small script that temporarily disables the ability of the user to reboot or shut the computer down.

It is not necessary that the script is uncirumventable, it's just to let the users of the system know that the backup is in progress and they shouldn't shut down. I've seen the Inhibit method on the DBus Free desktop power management spec: http://people.freedesktop.org/~hughsient/temp/power-management-spec-0.3.html but that only prevents shutdowns if the system is idle not explicitly at the users request.

Is there an easy way to do this in C/Python/Perl or bash?

Update: To clarify the question above, it's a machine with multiple users, but who use it sequentially via the plugged in keyboard/mouse. I'm not looking for a system that would stop me "hacking" around it as root. But a script that would remind me (or another user) that the backup is still running when I choose shut down from the Gnome/GDM menus

Edit
Report

1 Answer

1

If users are going to be shutting down via GNOME/KDE, just inhibit them from doing so.

http://live.gnome.org/GnomePowerManager/FAQ#head-1cf52551bcec3107d7bae8c332fd292ec2261760

answered 2009-03-13T03:49:21.473

Your Answer