Shutdown script
Is there some script some where that gets called before the computer shuts down. I want to add something simple to save my total download/upload amounts by grabing them from /proc/net/dev before the computer turns off every time.
|
You can install a script in your runlevel 0, and run level 6, to capture them.
|
Where do I do that? some where in like /etc/init*?
|
wait... /etc/rc0.d and /etc/rc6.d do I just add it in there?
|
There's another directory /etc/init.d you put the script in there. Something like
Code:
#!/bin/sh cd /etc/rc0.d ln -s ../init.d/scriptname S10scriptname cd ../rc6.d ln -s ../init.d/scriptname S10scriptname The numbers are low in case anything that is shutdown by a script later thats required is still there. Edit: also don't forget to make the script executable chmod +x scriptname |
Quote:
So you probably want to rename them to something higher than 10 or it won't work. Code:
mv /etc/rc6.d/S00killall /etc/rc6.d/S11killall && /etc/rc6.d/S01reboot /etc/rc6.d/S12reboot |
Thats weird mine are set too 90, so what happens to all the stuff that needs shutting down on Madrake? They just get killed?
|
That's what the "K" entries are for (IIRC). When changing runlevel the system first runs the K(ill) entries in the new runlevel
(I've got 21 of them in rc0.d). Then it "starts" the S ones. Thinking of that Hexane perhaps have to put his script in K30 or something depending on if K90network clears some entries. - Peder |
All times are GMT -5. The time now is 06:14 PM. |