# idea from: http://wiki.43folders.com/index.php/Time_sampling
-BEEP="beep -f707 -n -f500"
+#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"
MINUTES=6 #to give 10/hour
#MAXJOBS=$((1*60/$MINUTES))
#MAXJOBS=8
}
+
+# calculate the minutes to the next $MINUTES slot from top-of-hour
+function nexttime {
+ #remove leading zero to ensure we stay in base-10
+ nowmin=$(date '+%M' | sed 's/^0//')
+ echo $(( $MINUTES - ($nowmin % $MINUTES) ))
+}
+
+
+
+
+thispid=$$
while true; do
- [[ $(lastActivity) != "null" ]] && $BEEP && sleep 0.8
+ if [[ $(lastActivity) != "null" ]]; then
+ $BEEP > /dev/null 2>&1
+ sleep 0.8
+ fi
(sampleTask) &
pid=$!
fi
done
- sleep $(($MINUTES*60 - 1))
+ #send a continue signal to myself in the future
+ echo "kill -CONT $thispid" | at now + $(nexttime) minutes > /dev/null 2>&1
+ #stop myself until continued
+ kill -SIGSTOP $thispid
+
+ #sleep $(($MINUTES*60 - 1))
done