Print current state to plot
authorHarvie <tomas@mudrunka.cz>
Fri, 3 Aug 2012 04:23:58 +0000 (06:23 +0200)
committerHarvie <tomas@mudrunka.cz>
Fri, 3 Aug 2012 04:24:30 +0000 (06:24 +0200)
c/goertzel/sleepplot.sh

index 00d275a62fccdebeb5ed75c50b8d087a15966208..0e8ed5eef79f0beb99379187a905f1e2100ecb91 100755 (executable)
@@ -9,6 +9,10 @@ in="$1";
 graphout="${in%%.*}.png"
 test -n "$2" && graphout="$2";
 
+#Last state
+last="$(tail -n 1 "$in" | cut -d ' ' -f 4)"
+test "$last" -gt 0 && last="motion" || last="peace";
+
 #Approximate size of graph
 size="$(tail -n 1 "$in" | cut -d . -f 1)"
 test $size -gt 3600 && size="$(( $size/10 ))" #For prolonged periods
@@ -19,7 +23,7 @@ gnuplot << EOF
 set output "$graphout"
 set terminal png size $size,400
 
-set title "Sleep motions"
+set title "Sleep motions (current state: $last)"
 set xlabel "time"
 set ylabel "motion"
 
This page took 0.129118 seconds and 4 git commands to generate.