Execute a command at shutdown
To dismount TrueCrypt volumes at shutdown and reboot time, I created a script, put it in
/etc/init.d/and symlinked it into the needed
Here is the detail:
/etc/init.d/truecrypt: #!/bin/bash case "$1" in start) #do nothing; I will mount the volume I need when I need it ;; stop) #dismount all volumes truecrypt -d ;; *) echo $"Usage: $0 -d" exit 1 esac exit $?Then I launched this command:
update-rc.d truecrypt stop 25 0 1 6 .that created these symbolic links:
/etc/rc0.d/K25truecrypt -> ../init.d/truecrypt /etc/rc1.d/K25truecrypt -> ../init.d/truecrypt /etc/rc6.d/K25truecrypt -> ../init.d/truecryptIt means that at runlevel 0, 1 and 6 (halt, single-user and reboot)
/etc/init.d/truecrypt stopwill be executed after all the scripts with the name starting in
kill, and coming before it in alphabetical order.
If I wanted to run a script at start too I would symlink the script like this:
update-rc.d myscript start 25 2 3 4 5 . stop 25 0 1 6 .It means that at runlevel 2, 3, 4 and 5 (multiuser runlevels)
/etc/init.d/myscript startwould be executed after all the scripts with the name starting in
start, in alphabetical order, and at runlevel 0, 1 and 6
/etc/init.d/myscript stopwill be executed.
man initor debian.org for more info about runlevel.