638 Byte hinzugefügt,
15:58, 29. Sep. 2017
<pre>
#!/bin/bash
#
### BEGIN INIT INFO
# Description:
# location: /etc/init.d/orobot
### END INIT INFO
workdir=/home/pi/git/SpaceREx/orobot/webserver/
start() {
echo "start orobot"
cd $workdir
python app.py &
}
stop() {
echo "stop orobot"
cd $workdir
pid=`ps -ef | grep '[p]ython app.py' | awk '{ print $2 }'`
echo $pid
kill $pid
}
# Actions
case "$1" in
start)
start
;;
stop)
# STOP
stop
;;
restart)
# RESTART
echo "restart orobot"
stop
start
;;
*)
echo "Usage: /etc/init.d/orobot {start|stop|restart}"
exit 1
esac
exit 0
</pre>