Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- ### USER CONFIGURABLE PARAMS
- MASTERSWITCH="40"
- SUBSCRIPT="/opt/domoticz/scripts/heateron.sh"
- ### END OF USER CONFIGURABLE PARAMS
- SSNAME=`basename $SUBSCRIPT`
- device_id=$3
- status=$4
- if [ "$device_id" = "$MASTERSWITCH" ] ; then
- CHK=`ps aux|grep $SUBSCRIPT|grep -v grep`
- if [ "$status" = "On" ] ; then
- if [ "$CHK" = "" ] ; then
- echo "Heater control system is ON"
- $SUBSCRIPT &
- else
- echo "$SSNAME already running"
- fi
- else
- if [ "$CHK" != "" ] ; then
- echo "$SSNAME control system is OFF"
- killall -9 $SSNAME
- else
- echo "Heater not running"
- fi
- fi
- fi
Advertisement
Add Comment
Please, Sign In to add comment