我为我的python机器人创建了一个超基本的init.d脚本:
#!/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
并已torbot.py
成为+x
和#!/usr/local/bin/python
在顶部。当我尝试实际启动它时,我得到:
:/var/lock/subsys$ sudo service torbot start
Failed to start torbot.service: Unit torbot.service not found.
我想念什么吗?