init.d scripts for shutdown and reboot
Tommy Trussell
tommy.trussell at gmail.com
Thu Dec 11 15:13:38 UTC 2008
On Thu, Dec 11, 2008 at 8:40 AM, Kailesh Mussai <kmussa at cs.mcgill.ca> wrote:
> On Thu, Dec 11, 2008 at 12:28:22AM -0000, Cameron Hutchison wrote:
>
>> Kailesh Mussai <kmussa at cs.mcgill.ca> writes:
>>
>> >I am trying to understand how ubuntu does a shutdown. From what I
>> >understand in the rc0.d, here is a part of ls -l:
>>
>> >root at turkana:/etc/rc0.d# ls -l
>>
>> >lrwxrwxrwx 1 root root 13 2008-10-10 11:45 K01gdm -> ../init.d/gdm
>> >---snip----
>> >lrwxrwxrwx 1 root root 22 2008-10-10 11:45 S31umountnfs.sh -> ../init.d/umountnfs.sh
>> >lrwxrwxrwx 1 root root 17 2008-10-14 10:30 S32portmap -> ../init.d/portmap
>> >lrwxrwxrwx 1 root root 20 2008-10-10 11:45 S35networking -> ../init.d/networking
>> >lrwxrwxrwx 1 root root 18 2008-10-10 11:45 S40umountfs -> ../init.d/umountfs
>> >lrwxrwxrwx 1 root root 20 2008-10-10 11:45 S60umountroot -> ../init.d/umountroot
>> >lrwxrwxrwx 1 root root 14 2008-10-10 11:45 S90halt -> ../init.d/halt
>>
>> >The init scripts umountnfs.sh, umountfs, umountroot do nothing when
>> >started but only when stopped, an example is:
>>
>> >root at turkana:/etc/rc0.d# /etc/init.d/umountfs start # No-op
>>
>> >The reason I am asking is,
>>
>> I'm not sure what you're asking, as there is no question in your
>> message.
>>
>> It may help you to know that in runlevels 0 and 6, the S* scripts are
>> run with the "stop" argument. In the other runlevels, the S* scripts are
>> run with the "start" argument. For all runlevels, K* scripts are run
>> with the "stop" argument.
>>
>>
>> --
>> ubuntu-users mailing list
>> ubuntu-users at lists.ubuntu.com
>> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
> +-------------------
>
> Thank you Cameron, that does help me understand why they would have the
> init.d/umount* as S* scripts in runlevel 0 and 6.
>
> I am trying to understand the shutdown process, as our own custom setup
> is failing to umount the local drive giving us "resource is busy" before
> shutting down.
>
> Hence my question is how does the shutdown process works, especially the
> part where the unmounting is concerned?
>
> Best,
> Kailesh
If you have a test or non-production system with the hardware you are
looking at, how about opening a console window and playing around with
it?
You could add some diagnostic messages to some of the scripts if
you're not sure they're being called, and watch for your messages to
appear when you change runlevels.
One way to change your runlevels is using the telinit command
to go to runlevel 3
# telinit 3
or to go to runlevel 0
# telinit 0
BY THE WAY -- the # means a root prompt. You can get there by
activating root OR by using any of the several sudo tricks to imitate
it. (or you can prepend "sudo" to any of the lines above)
More information about the ubuntu-users
mailing list