Created
March 13, 2012 09:49
-
-
Save jibone/2027901 to your computer and use it in GitHub Desktop.
Creating a Debian init script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# /etc/init.d/blah | |
# | |
# Some things that run always | |
touch /var/lock/blah | |
# Carry out specific functions when asked to by the system | |
case "$1" in | |
start) | |
echo "Starting script blah " | |
echo "Could do more here" | |
;; | |
stop) | |
echo "Stopping script blah" | |
echo "Could do more here" | |
;; | |
*) | |
echo "Usage: /etc/init.d/blah {start|stop}" | |
exit 1 | |
;; | |
esac | |
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@skx:~# update-rc.d blah defaults | |
Adding system startup for /etc/init.d/blah ... | |
/etc/rc0.d/K20blah -> ../init.d/blah | |
/etc/rc1.d/K20blah -> ../init.d/blah | |
/etc/rc6.d/K20blah -> ../init.d/blah | |
/etc/rc2.d/S20blah -> ../init.d/blah | |
/etc/rc3.d/S20blah -> ../init.d/blah | |
/etc/rc4.d/S20blah -> ../init.d/blah | |
/etc/rc5.d/S20blah -> ../init.d/blah |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@skx:/etc/rc2.d# update-rc.d -f blah remove | |
update-rc.d: /etc/init.d/blah exists during rc.d purge (continuing) | |
Removing any system startup links for /etc/init.d/blah ... | |
/etc/rc0.d/K20blah | |
/etc/rc1.d/K20blah | |
/etc/rc2.d/S20blah | |
/etc/rc3.d/S20blah | |
/etc/rc4.d/S20blah | |
/etc/rc5.d/S20blah | |
/etc/rc6.d/K20blah |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment