X-Git-Url: http://git.harvie.cz/?a=blobdiff_plain;f=c%2Fgoertzel%2Fsleepmon.sh;h=4896e87327002696a3092d70f5ea4c3351ddf36e;hb=19a509d14a28519397f352f3cd0570c9becf7c47;hp=3b975ba06d0c84c9a1913dda205638bef4ac98d2;hpb=c7611c89afefbf2ab4e36e50a83b8ec5b2e516ae;p=mirrors%2FPrograms.git diff --git a/c/goertzel/sleepmon.sh b/c/goertzel/sleepmon.sh index 3b975ba..4896e87 100755 --- a/c/goertzel/sleepmon.sh +++ b/c/goertzel/sleepmon.sh @@ -13,7 +13,7 @@ # Enjoy your data -out=/tmp/sleeplog-"$(date +%F_%r)".txt +out=/tmp/sleeplog-"$(date +%F_%T)".txt speaker-test -t sine &>/dev/null & tresh=10 lastdate=0 @@ -21,11 +21,12 @@ screen=false while getopts "s" OPT; do test "$OPT" == 's' && screen=true; done -arecord | ./goertzel -n -q -l -t $tresh -d 4 | while read line; do +echo "Writing to file: $out"; +arecord | ./goertzel -n i -q -l c -t $tresh -d 4 | while read line; do date="$(date +%s)" time="$(echo "$line" | cut -f 1)" level="$(echo "$line" | cut -f 2)" - echo -ne "$time\t$date\t$(date '+%F%t%r')\t" + echo -ne "$time\t$date\t$(date '+%F%t%T')\t" test "$level" -gt "$tresh" && { echo -n "Nothing detected..."; $screen && xset dpms force off || true; @@ -41,4 +42,5 @@ arecord | ./goertzel -n -q -l -t $tresh -d 4 | while read line; do lastdate="$date"; done | tee "$out" kill $! +echo echo "Your file: $out"