#! /bin/sh
# /etc/init.d/monitor

case "$1" in
  start)
    echo "Starting alarm monitor"
    /home/pi/monitor.py 2>&1 &
    ;;
  stop)
    echo "Stopping alarm monitor"
    # kill application you want to stop
    LP_PID=`ps auxwww|grep monitor.py|head -1|awk '{print $2}'`
    kill -9 $LP_PID
    ;;
  *)
    echo "Usage: /etc/init.d/monitor {start|stop}"
    exit 1
    ;;
esac


exit 0
