sample movement fix
authorBernhard Tittelbach <xro@realraum.at>
Sun, 21 Mar 2010 00:30:23 +0000 (00:30 +0000)
committerBernhard Tittelbach <xro@realraum.at>
Sun, 21 Mar 2010 00:30:23 +0000 (00:30 +0000)
sensor_graph/sample_sensors.sh

index bc666fb..ed902d5 100755 (executable)
@@ -1,6 +1,10 @@
 #!/bin/sh
+sleep 2
 echo -e "listen sensor\n" | usocket /var/run/powersensordaemon/cmd.sock -n | ./sample_sensor.lua &>/dev/null &
-echo -e "listen movement\n" | usocket /var/run/powersensordaemon/cmd.sock -n > /tmp/movement.tmp &
+PID1=$!
+echo -e "listen movement\n" | usocket /var/run/powersensordaemon/cmd.sock -n >> /tmp/movement.tmp &
+PID2=$!
+trap "kill $PID1 $PID2" 0
 while sleep 30; do
   L=$(wc -l /tmp/movement.tmp | cut -d' ' -f1)
   echo -n > /tmp/movement.tmp