#!/bin/sh
# Starts and stops rpc.mountd
#
### BEGIN INIT INFO
# Provides:          WLANThermo
# Required-Start:    
# Required-Stop:     
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Startet WLANThermo Dienst
# Description:       Startet WLANThermo Dienst und Datenlogger 
### END INIT INFO

case "$1" in
start)

    python /usr/sbin/wlt_2_comp.py >/dev/null &
    echo "Starting WLAN Thermometer"    

;;

stop)
    
    kill $(ps aux|grep "wlt_2_comp.py"| grep -v grep |awk '{print $2}')
    echo "Stopping WLAN Thermometer"

;;

restart)
    $0 stop
    $0 start
;;

cleanup)

    kill $(ps aux|grep "wlt_2_comp.py"| grep -v grep |awk '{print $2}')
    cd /var/log/WLAN_Thermo
    rm *.csv
    echo "WLAN Thermometer gestoppt, alle Logs gelscht!"
;;

*)
        echo "Usage: $0 {start|stop|restart|cleanup}"
        exit 1
esac
