Which scripts are executed at shutdown time?

Asked by Jim Pivarski

I'd like to add AutoFsck to the set of processes which are called at shutdown time, but I'm not running gdm, xdm, or kdm. By default, AutoFsck inserts a script into gdm's PostProcess/Default (but that doesn't get called on my computer, since gdm isn't running). I'd like to find the equivalent of /etc/init.d for shutdown tasks, and I want to be certain that the script will be called after the root partition is unmounted, because I don't want to run fsck while / is mounted. (Otherwise, I would just run it on the command prompt every now and then!)

I do see Ubuntu's shutdown splash screen, so I know that that process is running, and it continues to run after / is unmounted.

If anyone can help, thank you!!!
-- Jim

P.S. Sorry if this is not the right forum for information requests--- a lot of the messages here seem to be about bugs and crashes.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Terence Simpson
Solved:
Last query:
Last reply:
Revision history for this message
Sam Cater (wraund-deactivatedaccount) said :
#1

you should really use forum.ubuntu.com

anyway, if you want to see what is happening to your machine. run...

sudo nano /boot/grub/menu.lst

move down the page, near the bottom things should look fammiliar.

look for the most recent kernel. and look near the end of the line, there should be something like 'splash' or 'usplash'. remove it on the latest kernel, and the recovery mode version below it.

do ctrl-o to save, then ctrl-x to exit.

restart the computer and boot, instead of a splash screen you should see what the machine is doing during boot up.

recovery mode gives an even more detailed boot up, but i dont reccomend running recovery mode unless needed, cos its there for 'recovery' :P

Revision history for this message
Jim Pivarski (jpivarski) said :
#2

Okay, I was just about to move my question to forum.ubuntu.com, but I don't find a forum there, I find a defunct Bugzilla with a link back here. Did you mean a different link?

I'm sorry, but I think you misunderstood my problem. I'm happy with the processes that are called at boot-up; thanks for the tip on how to view the messages without the splash screen, though. I'm looking for a way to add a process to shutdown, strictly after unmounting /. I suppose if I turned off the slash screen, I would see the shutdown processes also, but that wouldn't tell me the paths to the scripts that are called, so that I can insert a call to AutoFsck. (Though I suppose I could note the text of the shutdown messages and recursively grep all of /etc, assuming that I picked a constant substring...) There may also be a special way of installing such a script, in analogy with update-rc.d for /etc/init.d scripts.

Thanks,
-- Jim

Revision history for this message
Best Terence Simpson (tsimpson) said :
#3

http://ubuntuforums.org is the Ubuntu forum, and if you want to add a script to the shutdown process then put the script in /etc/init.d and run "sudo update-rc.d NameOfScript stop 22 0 6" where "NameOfScript is the name of the script in /etc/init.d.
Then the script will be called as "/etc/init.d/NameOfScript stop" by the system (as root) on shutdown or restart.

Revision history for this message
Jim Pivarski (jpivarski) said :
#4

Thanks, I'll try that! (update-rc.d with the "stop" option--- I thought it was just for boot scripts--- and/or ubuntuforums.org.)

-- Jim