Shutdown scripts

Is there any way to add scripts to the shutdown process, similar to startup process? I have a machine without a monitor that I connect to remotely, and would basically like an audible beep immediately before or after the “It is now safe to turn off your computer” screen.

I could rename the shutdown binary and write a script that beeps and then calls the renamed shutdown binary. But, I generally shutdown from command line, so this method does not really have any benefit. I’d prefer to receive some acknowledgement that ‘its safe to turn off computer’ rather than relying on my internal clock and intuition.



You could go to Foundry27 and download the ‘shutdown’ code. Then you could modify it to look for a script file in a known location and run that file if it exists.

Of course that’s not much different that what you proposed (renaming shutdown and replacing the original with a script that calls the renamed shutdown).