1-Wire with Leds and Beeps oscar

1-wire-with-leds-and-beeps / software / zm_control.sh

665 B · raw

#!/bin/bash

JOB="$0"
COMMAND="$1"
shift


# My Cams have IP .101 - .102 - .103 and so on...

resume_after_successfull_ping () {
	rc=1; 
	while [ $rc -eq 1 ] ; do 
		ping 192.168.1.10$1 -q -c 1 > /dev/null ;
		rc=$?; 
	done; 

        /usr/bin/zmu -Uadmin -Ppassword --resume -m $1
}

case $COMMAND in
on)

resume_after_successfull_ping "1" & 
resume_after_successfull_ping "2" &
resume_after_successfull_ping "3" &


    ;;
off)
	/usr/bin/zmu -Uadmin -Ppassword --suspend -m 1
	/usr/bin/zmu -Uadmin -Ppassword --suspend -m 2
	/usr/bin/zmu -Uadmin -Ppassword --suspend -m 3

    ;;
*)
    echo
    echo "Usage: $JOB (on|off)" 1>&2
    echo
    exit 1
esac

exit 0