Code: Select all
#!/bin/sh
IP_ADDR="userid:pass@192.168.1.1:PortNum"
case "$1" in
left)
curl http://$IP_ADDR/decoder_control.cgi?command=4
sleep 1
curl http://$IP_ADDR/decoder_control.cgi?command=1
;;
right)
curl http://$IP_ADDR/decoder_control.cgi?command=6
sleep 1
curl http://$IP_ADDR/decoder_control.cgi?command=1
;;
up)
curl http://$IP_ADDR/decoder_control.cgi?command=0
sleep 1
curl http://$IP_ADDR/decoder_control.cgi?command=1
;;
down)
curl http://$IP_ADDR/decoder_control.cgi?command=2
sleep 1
curl http://$IP_ADDR/decoder_control.cgi?command=1
;;
upleft)
curl http://$IP_ADDR/decoder_control.cgi?command=90
sleep 1
curl http://$IP_ADDR/decoder_control.cgi?command=1
;;
upright)
curl http://$IP_ADDR/decoder_control.cgi?command=91
sleep 1
curl http://$IP_ADDR/decoder_control.cgi?command=1
;;
downleft)
curl http://$IP_ADDR/decoder_control.cgi?command=92
sleep 1
curl http://$IP_ADDR/decoder_control.cgi?command=1
;;
downright)
curl http://$IP_ADDR/decoder_control.cgi?command=93
sleep 1
curl http://$IP_ADDR/decoder_control.cgi?command=1
;;
vpatrol)
curl http://$IP_ADDR/decoder_control.cgi?command=26
;;
stopvpatrol)
curl http://$IP_ADDR/decoder_control.cgi?command=27
;;
hpatrol)
curl http://$IP_ADDR/decoder_control.cgi?command=28
;;
stophpatrol)
curl http://$IP_ADDR/decoder_control.cgi?command=29
;;
pos)
curl http://$IP_ADDR/decoder_control.cgi?command=$((30 + ($2*2-1)))
;;
*)
echo "Syntax:"
echo " up, down, left, right"
echo " upleft : up and left diagonally"
echo " upright : up and right diagonally"
echo " downleft : down and left diagonally"
echo " downright : down and right diagonally"
echo " vpatrol : vertical patrol"
echo " stopvpatrol: stop vertical patrol"
echo " hpatrol : horizontal patrol"
echo " stophpatrol: stop horizontal patrol"
echo " pos N : recall stored position N"
exit 1
;;
esac
exit 0