LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 10-09-2006, 04:35 PM   #1
LinuxBlackBox
Member
 
Registered: Sep 2003
Location: Canada
Distribution: Slackware 9
Posts: 243

Rep: Reputation: 30
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
 
Old 10-09-2006, 04:55 PM   #2
Kristijan
Member
 
Registered: Sep 2003
Location: Melbourne, Australia
Distribution: NetBSD 3.0.1, Slackware 10.1
Posts: 394

Rep: Reputation: 30
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

Last edited by Kristijan; 10-09-2006 at 04:58 PM.
 
Old 10-10-2006, 07:35 PM   #3
LinuxBlackBox
Member
 
Registered: Sep 2003
Location: Canada
Distribution: Slackware 9
Posts: 243

Original Poster
Rep: Reputation: 30
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
 
Old 10-10-2006, 07:50 PM   #4
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 70
man acpid
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deactivating forced shutdown because of high temperature? Thora Linux - Kernel 8 05-20-2006 08:05 AM
How to run a script at startup after a shutdown? kklein9 Linux - Software 3 01-27-2006 03:32 PM
Run some commands on system shutdown luizrolla Linux - Newbie 1 07-12-2004 07:42 PM
Shutdown when in run level 4 chestnut Slackware 3 02-19-2004 02:31 AM
Run commands at logout/shutdown sbaguz Linux - General 2 08-21-2003 11:55 AM


All times are GMT -5. The time now is 09:32 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration