Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

Run script just before linux reboot (runlevel 6 / rc6.d) (See related posts)

update-rc.d is the program (script) which creates the necessary symbolic links to the /etc/rcX.d directories.

Here we are running the script found at /etc/init.d/updatedb_start, within runlevel 6, which is reboot.

Running this will create a symbolic link to the actual script file which lives within /etc/init.d (as it always should).

So, within /etc/rc6.d/ we'll see a symbolic link to our script.

The period at the end of the command is required. Tells update-rc.d that we're finished with the command (no further runlevels to edit).

We're using "stop" instead of "start" because we want to run the script during the killing off scripts part of the rc6.d scripts.
This causes the script to be run with a "stop" parameter, for example: updatedb_start stop
We don't actually use the stop parameter in this case, it's just ignored.

update-rc.d updatedb_start stop 18 6 .

You need to create an account or log in to post comments to this site.