#! /bin/sh
### BEGIN INIT INFO
# Provides: noip
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: noip server
# Description:
### END INIT INFO
 
case "$1" in
    start)
        echo "Wetter-Station wird gestartet"
        # Starte Programm
        nohup python /home/pi/tft_display.py >> /var/log/weatherstation.log 2>&1 &
        ;;
    stop)
        echo "Wetter-Station wird beendet"
        # Beende Programm
        pkill -SIGTERM -f /home/pi/tft_display.py
        ;;
    restart)
        echo "Wetter-Station wird neu gestartet"
        # Restart Programm
        pkill -SIGTERM -f /home/pi/tft_display.py
        nohup python /home/pi/tft_display.py >> /var/log/weatherstation.log 2>&1 &
	;;
    *)
        echo "Benutzt: /etc/init.d/weatherstation {start|stop|restart}"
        exit 1
        ;;
esac
 
exit 0
