SpaceRExStartStopScript: Unterschied zwischen den Versionen

Aus Hackerspace Ffm
Wechseln zu: Navigation, Suche
(Die Seite wurde neu angelegt: „ <pre> #!/bin/bash # ### BEGIN INIT INFO # Description: # location: /etc/init.d/orobot ### END INIT INFO workdir=/home/pi/git/SpaceREx/orobot/webserver…“)
(kein Unterschied)

Version vom 29. September 2017, 16:58 Uhr


#!/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