Eu criei um script init.d super básico para o meu bot python:
#!/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
E ter definido torbot.py
para ser +x
e #!/usr/local/bin/python
no topo. Quando tento realmente iniciá-lo, recebo:
:/var/lock/subsys$ sudo service torbot start
Failed to start torbot.service: Unit torbot.service not found.
Estou esquecendo de algo?