I run a desktop computer, which typically is shut down for the nights and often also during the day, when not in use or left unattended. I usually shut it down from GUI (KDE 4.10), sometimes - from KDM, and sometimes I also use a good, old /sbin/shutdown.
Now: it happens that a task is running, which should not be interrupted, such as a backup, video recording, etc. For obvious reasons, in such cases I would prefer that the shutdown is postponed until the job is finished. Ideally a warning should be issued to the user, but that's not always possible. How to achieve this?
Some time ago I wrote a script executed in a runlevels 0 and 6, which checked for existance of a flag file, and postponed the process until the file disappeared. It was not ideal, but efficient enough. But in recent versions of my distribution init was replaced with systemd, which runs /etc/init.d/ scripts in parallel, so the hack does not work any more.
If it's of any importance, I use OpenSuse 12.3, kernel 3.7.10, KDE 4.10.