From: Bernhard Tittelbach Date: Mon, 19 Apr 2010 18:58:08 +0000 (+0000) Subject: cgi X-Git-Url: https://git.realraum.at/?a=commitdiff_plain;h=0b2fad28aeaf52326887d8223848d803fd890e20;p=svn42.git cgi --- diff --git a/powersensordaemon/switch.cgi b/powersensordaemon/switch.cgi new file mode 100755 index 0000000..765778c --- /dev/null +++ b/powersensordaemon/switch.cgi @@ -0,0 +1,61 @@ +#!/bin/sh + +for QUERY in `echo $QUERY_STRING | tr '&' ' '`; do + for VALUE in `echo $QUERY | tr '=' ' '`; do + if [ "$VALUE" == "id" ]; then + ID='?' + elif [ "$ID" == "?" ]; then + ID=$VALUE + elif [ "$VALUE" == "power" ]; then + POWER='?' + elif [ "$POWER" == "?" ]; then + POWER=$VALUE + fi + i=$i+1 + done +done + +UNIXSOCK=/var/run/powersensordaemon/cmd.sock +VALIDIDS="werkzeug stereo labor schreibtisch logo idee deckehinten deckevorne" + +if [ "$POWER" == "on" -o "$POWER" == "off" ]; then + for CHECKID in $VALIDIDS; do + if [ "$CHECKID" == "$ID" ]; then + echo "power $POWER $ID" | usocket $UNIXSOCK + fi + done +fi + +DESC_werkzeug="Werkzeug LEDs" +DESC_stereo="Stereo Anlage" +DESC_labor="Labor Licht" +DESC_schreibtisch="Schreibtisch Licht" +DESC_logo="Logo" +DESC_idee="Idee" +DESC_deckehinten="Decke Hinten" +DESC_deckevorne="Decke Vorne" + +echo "Content-type: text/html" +echo "" +echo "" +echo "" +echo "Realraum rf433ctl" +echo "" +echo "" +echo "

Realraum rf433ctl

" +echo "" +for DISPID in $VALIDIDS; do + NAME="$(eval echo \$DESC_$DISPID)" + [ -z "$NAME" ] && NAME=$DISPID + echo "" + echo "" +# echo " " + echo "" + echo "" +done +echo "
$NAME
$NAME
" + echo " " + echo " " + echo "
" +echo "" +echo ""