How to run a command as root when I shutdown system automatically ?
On Tue, Apr 5, 2011 at 1:41 AM, Kumar Appaiah <email@example.com> 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:
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.*
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*