lightlevel direclty from slug to http
authorBernhard Tittelbach <xro@realraum.at>
Mon, 28 Feb 2011 21:15:24 +0000 (21:15 +0000)
committerBernhard Tittelbach <xro@realraum.at>
Mon, 28 Feb 2011 21:15:24 +0000 (21:15 +0000)
powersensordaemon/lightlevel.cgi [new file with mode: 0755]

diff --git a/powersensordaemon/lightlevel.cgi b/powersensordaemon/lightlevel.cgi
new file mode 100755 (executable)
index 0000000..0b031af
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh
+UNIXSOCK=/var/run/powersensordaemon/cmd.sock
+TMPFILE=$(mktemp)
+echo "sample photo0" | usocket $UNIXSOCK -n > $TMPFILE &
+PID=$!
+echo "Content-type: text/html"
+echo ""
+while [ ! -s $TMPFILE ]; do 
+       continue
+done
+cat $TMPFILE | cut -d' ' -f 2
+rm $TMPFILE
+kill $PID
+exit 0