### BEGIN INIT INFO # Provides: Current Sensor Readings # Starts reading the current sensor # Required-Start: $remote_fs $syslog $all # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Read Current Sensor # Description: Upload Values to Cosm ### END INIT INFO #! /bin/sh # /etc/init.d/sensor export HOME case "$1" in start) echo "Starting to read current sensor." sudo python /home/pi/sensor/readsensor.py ;; stop) echo "Stopping sensor reading." SENSOR_PID=`ps auxwww | grep readsensor.py | head -1 | awk '{print $2}'` kill -9 $SENSOR_PID ;; *) echo "Usage: /etc/init.d/sensor {start|stop}" exit 1 ;; esac exit 0