Ho creato uno script init.d di base per il mio 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 hanno impostato torbot.py
per essere +x
e #!/usr/local/bin/python
in cima. Quando provo ad avviarlo effettivamente, ottengo:
:/var/lock/subsys$ sudo service torbot start
Failed to start torbot.service: Unit torbot.service not found.
Mi sto perdendo qualcosa?