LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Run command on forced shutdown (https://www.linuxquestions.org/questions/linux-software-2/run-command-on-forced-shutdown-490927/)

LinuxBlackBox 10-09-2006 04:35 PM

Run command on forced shutdown
 
I'm looking for information on how to run a command when the system is shut down. Specifically, when the power button on the front of the case is pressed and the system is forced to shut down. Is there any way to differentiate between the types of shutdown? And how do I go about having a command become a part of the shutdown procedure?

Thank you

Kristijan 10-09-2006 04:55 PM

Hi,

I know with RedHat that when changing to runlevel 0 (halt) - It runs the following script /etc/rc.d/init.d/halt

I'm sure there is a much better way of executing commands at shutdown, rather then hacking at this script. Wether or not you can differentiate between different types of shutdowns, I don't know.

Hopefully this gets you pointed in the right direction.

EDIT: Just saw in you're profile that you are using Slackware. I don't have a Slackware box infront of me (I do at home), but take a look around the /etc/rc.d directory and subdirectories, I'm sure you will find something in there.

-Kristijan

LinuxBlackBox 10-10-2006 07:35 PM

I'm running Mandriva now, actually, (should prbably update that, haha) but I'm thinking it still should use the same shutdown procedure. I'll give init.d/halt a try

Thanks for your help

osor 10-10-2006 07:50 PM

man acpid


All times are GMT -5. The time now is 02:27 AM.