Could be used as a template in /etc/init.d
#!/bin/sh
# Start/stop the foo system
# /etc/init.d/foo
#
test -f "/etc/foo.conf" || exit 1
case "$1" in
start) echo -n "Starting foo"
...
echo "."
;;
stop) echo -n "Stopping foo"
...
echo "."
;;
restart) echo -n "Restarting foo"
...
sleep 2
...
echo "."
;;
*) echo "Usage: /etc/init.d/foo start|stop|restart"
exit 1
;;
esac
exit 0