I created a super basic init.d script for my python bot:
#!/bin/bash
# chkconfig: 2345 20 80
# description: Description comes here....
# Source function library.
. /etc/init.d/functions
start() {
echo "starting torbot"
python /home/ctote/dev/slackbots/torbot/torbot.py
# example: daemon program_name &
}
stop() {
# code to stop app comes here
# example: killproc program_name
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
# code to check status of app comes here
# example: status program_name
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
esac
And have set torbot.py
to be +x
and #!/usr/local/bin/python
at the top. When I try to actually start it though, I get:
:/var/lock/subsys$ sudo service torbot start
Failed to start torbot.service: Unit torbot.service not found.
Am I missing something?