routec.init.d.example
#!/bin/bash
# /etc/init.d/route_c
### BEGIN INIT INFO
# Provides: route_c
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This service is used to manage route_c
### END INIT INFO
export SIR_HANDEL_USERNAME={YOUR USERNAME}
export SIR_HANDEL_PASSWORD={YOUR PASSWORD}
case "$1" in
start)
echo "Starting route_c"
sudo -E routec watch --daemon
;;
stop)
echo "Stopping route_c"
PID=`cat /tmp/.pid` && sudo kill -15 $PID
;;
restart)
echo "Restarting route_c"
PID=`cat /tmp/.pid` && sudo kill -15 $PID && sudo -E routec watch --daemon
;;
esac
exit 0