Step 1
Put this shell script in /etc/init.d/nitrogen.sh
#! /bin/sh
### BEGIN INIT INFO
# Provides: nitrogen
# Required-Start: mysql
# Required-Stop:
# Should-Start:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start Erlang VM and Nitrogen.
### END INIT INFO
case "$1" in
start)
echo "Starting Erlang VM and Nitrogen "
/nitrogen/bin/nitrogen start
;;
restart)
echo "Restarting Erlang VM and Nitrogen "
/nitrogen/bin/nitrogen restart
;;
stop)
echo "Stopping Erlang VM and Nitrogen"
/nitrogen/bin/nitrogen stop
;;
*)
echo "Usage: /etc/init.d/nitrogen.sh {start|restart|stop}"
exit 1
;;
esac
exit 0
Not that I listed mysql as a dependency (must be started first). This is specific for my nitrogen site, but might not be necessary for yours. You can leave it empty if you don't need it.
The sequence number is automagically determined based on the dependencies.
Step 2
Make sure its owned by root:
chown root.root /etc/init.d/nitrogen.sh
and executable:
chmod 755 /etc/init.d/nitrogen.sh
Step 3
Add the proper links in rcX.d directories:
insserv nitrogen.sh
On older debian versions (before 6) where insserv is not present, do:
update-rc.d nitrogen.sh start 99 2 3 4 5 . stop 20 0 1 6 .
I picked 99 as the sequence number here, so I'm reasonable sure any dependencies are started first. The default is 20, which is bit to early if you ask me.
That's it, done.
No comments:
Post a Comment