grml
authorBernhard Tittelbach <xro@realraum.at>
Tue, 23 Mar 2010 12:35:20 +0000 (12:35 +0000)
committerBernhard Tittelbach <xro@realraum.at>
Tue, 23 Mar 2010 12:35:20 +0000 (12:35 +0000)
sensor_graph/sample_sensors.sh

index ed902d5..6474ed5 100755 (executable)
@@ -4,9 +4,9 @@ echo -e "listen sensor\n" | usocket /var/run/powersensordaemon/cmd.sock -n | ./s
 PID1=$!
 echo -e "listen movement\n" | usocket /var/run/powersensordaemon/cmd.sock -n >> /tmp/movement.tmp &
 PID2=$!
-trap "kill $PID1 $PID2" 0
+trap "kill $PID1 $PID2" 0 INT QUIT
 while sleep 30; do
-  L=$(wc -l /tmp/movement.tmp | cut -d' ' -f1)
+  L=$(wc -l /tmp/movement.tmp | sed 's/[^0-9]*//g')
   echo -n > /tmp/movement.tmp
   rrdtool update /home/sensormovement.rrd -t movement N:$L
 done