From: Dan White Date: Fri, 6 Jun 2014 16:59:37 +0000 (-0500) Subject: Better time sampling X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=622cf850fe3d3ed9b469f69b27f372c3b88d53de;p=pubbin.git Better time sampling --- diff --git a/cleanup-timesamples b/cleanup-timesamples index e8e823b..e31b03d 100755 --- a/cleanup-timesamples +++ b/cleanup-timesamples @@ -3,14 +3,18 @@ # cleanup data from timeSampler, # removes null entries and sorts by time -# -e edits before cleanup +# no argument edits before cleanup # -E edits after cleanup -if [ "$1" = "-e" ]; then - vim $HOME/.timeSampler.$HOSTNAME +TMPFILE=$(tempfile) + +if [ "$1" = "" ]; then + orig="$HOME/.timeSampler.$HOSTNAME" + sort -u $orig > $TMPFILE + cp $TMPFILE $orig + vim $orig shift fi -TMPFILE=$(tempfile) for f in $(ls -1 $HOME/.timeSampler.*); do grep -v "null$" $f | sort -u > $TMPFILE cp $TMPFILE $f diff --git a/timeSampler b/timeSampler index 4777c4a..2be7fe3 100755 --- a/timeSampler +++ b/timeSampler @@ -11,7 +11,7 @@ #BEEP="beep -f707 -n -f500" #BEEP="beep -f707 -n -f500 -n -f707" #BEEP="dcop knotify default notify notify Me notext KDE_Vox_Ahem.ogg nofile 1 0" -BEEP="aplay /usr/share/sounds/pop.wav" +BEEP="aplay /home/dan/tmp/pop.wav" MINUTES=6 #to give 10/hour #MAXJOBS=$((1*60/$MINUTES)) #MAXJOBS=8 @@ -19,6 +19,7 @@ MAXJOBS=17 MAXJOBS=$(($MAXJOBS-1)) LOGFILE="$HOME/.timeSampler.$HOSTNAME" +BACKUPFILE="$HOME/.timeSampler.all" #put something in the buffer to start for i in $(seq 0 $MAXJOBS); do @@ -50,6 +51,7 @@ function sampleTask { fi echo "$DATE $ACTIVITY" >> $LOGFILE + echo "$HOSTNAME $DATE $ACTIVITY" >> $BACKUPFILE }