FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 04-05-2011, 04:46 AM
 
Default How to run a command as root when I shutdown system automatically ?

>>>>> "w" == waterloo <waterloo2005@gmail.com> writes:
w> How to run a command as root when I shutdown system automatically ?
w> I use Debian 6 amd64.

make a /root/bin/myshutdown script and run that instead perhaps.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87zko5l2ym.fsf@jidanni.org">http://lists.debian.org/87zko5l2ym.fsf@jidanni.org
 
Old 04-05-2011, 05:41 AM
Kumar Appaiah
 
Default How to run a command as root when I shutdown system automatically ?

On Tue, Apr 05, 2011 at 11:57:31AM +0800, waterloo wrote:
> How to run a command as root when I shutdown system automatically ?
> I use Debian 6 amd64.

Searching online led me to this:

http://synapse.wordpress.com/2007/03/24/run-a-script-on-startup-shutdown-in-linux/

HTH.

Kumar
--
The chat program is in public domain. This is not the GNU public license.
If it breaks then you get to keep both pieces.
-- Copyright notice for the chat program


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20110405054125.GA15850@bluemoon.alumni.iitm.ac.in" >http://lists.debian.org/20110405054125.GA15850@bluemoon.alumni.iitm.ac.in
 
Old 04-05-2011, 06:27 AM
Chris Brennan
 
Default How to run a command as root when I shutdown system automatically ?

On Tue, Apr 5, 2011 at 1:41 AM, Kumar Appaiah <a.kumar@alumni.iitm.ac.in> wrote:

On Tue, Apr 05, 2011 at 11:57:31AM +0800, waterloo wrote:

> * *How to run a command as root when I shutdown system automatically ?

> * *I use Debian 6 amd64.



Searching online led me to this:



http://synapse.wordpress.com/2007/03/24/run-a-script-on-startup-shutdown-in-linux/



HTH.



Kumar

Off the top of my head (and requires debugging)
#!/usr/bin/env (ba)sh # (your choice of bash or sh)execute-your-cmd-hereshutdown -r now # swap -r for -h if you wish to halt instead of reboot



inversely you can 'man (or info) bash' and learn how to use case so you can pass switches to your script ... i.e.*
/root/bin/your-shutdown-script -r*


or
/root/bin/your-shutdown-script -h
If given enough inclination, I might be able to write something in python (albeit it crude and*rudimentary*but it should get the job done)


--
Did you know...
If you play a Windows 2000 CD backwards, you hear satanic messages,


but what's worse is when you play it forward....
...it installs Windows 2000
-- Alfred Perlstein on chat at freebsd.org*
 
Old 04-05-2011, 09:21 AM
Darac Marjal
 
Default How to run a command as root when I shutdown system automatically ?

On Tue, Apr 05, 2011 at 11:57:31AM +0800, waterloo wrote:
> How to run a command as root when I shutdown system automatically ?
> I use Debian 6 amd64.

Make it an init script that is only called in runmodes 0 (for shutdown)
and 6 (for reboot)? I think the proper way to do this would be to set
Default-Start to "Default-Start: 0 6" in the header.
 

Thread Tools




All times are GMT. The time now is 09:44 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org