From: Dan White Date: Tue, 20 Jan 2015 17:42:44 +0000 (-0600) Subject: update scripts X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=dc5515ec5acdfa523190d308ad2ef91986c3d0a2;p=pubbin.git update scripts --- diff --git a/TimeSampleHistogram b/TimeSampleHistogram index 244b841..fe42c30 100755 --- a/TimeSampleHistogram +++ b/TimeSampleHistogram @@ -144,7 +144,9 @@ else: # files = [f for f in os.listdir(os.environ['HOME']) if f.startswith('.timeSampler') and not - (f.endswith('.gz') or f.endswith('.all'))] + (f.endswith('.gz') + or f.endswith('.all') + or f.endswith('.tmp'))] hist = defaultdict(lambda: 0) histHier = defaultdict(lambda: 0) diff --git a/cleanup-timesamples b/cleanup-timesamples index e31b03d..3478322 100755 --- a/cleanup-timesamples +++ b/cleanup-timesamples @@ -2,26 +2,33 @@ # cleanup data from timeSampler, # removes null entries and sorts by time - # no argument edits before cleanup -# -E edits after cleanup -TMPFILE=$(tempfile) - -if [ "$1" = "" ]; then - orig="$HOME/.timeSampler.$HOSTNAME" - sort -u $orig > $TMPFILE - cp $TMPFILE $orig - vim $orig +# -s sorts before editing +# -c sorts and cleans "null" entries after editing + +SAMPLES="$HOME/.timeSampler.$HOSTNAME" +#TMPFILE=$(tempfile) +TMPFILE="$SAMPLES.tmp" + + +if [ "$1" = "-s" ]; then + echo "Sorting entries first." + sleep 2 + sort -u $SAMPLES > $TMPFILE + cp $TMPFILE $SAMPLES shift fi -for f in $(ls -1 $HOME/.timeSampler.*); do - grep -v "null$" $f | sort -u > $TMPFILE - cp $TMPFILE $f -done -rm -f $TMPFILE +vim $SAMPLES -if [ "$1" = "-E" ]; then - vim $HOME/.timeSampler.$HOSTNAME + +if [ "$1" = "-c" ]; then + echo "Cleaning and sorting all timeSamples." + for f in $(ls -1 $HOME/.timeSampler.*); do + grep -v "null$" $f | sort -u > $f.tmp + cp $f.tmp $f + done fi + + diff --git a/timeSampler b/timeSampler index 2be7fe3..53afc60 100755 --- a/timeSampler +++ b/timeSampler @@ -15,7 +15,7 @@ BEEP="aplay /home/dan/tmp/pop.wav" MINUTES=6 #to give 10/hour #MAXJOBS=$((1*60/$MINUTES)) #MAXJOBS=8 -MAXJOBS=17 +MAXJOBS=21 MAXJOBS=$(($MAXJOBS-1)) LOGFILE="$HOME/.timeSampler.$HOSTNAME"