Skip to content

Instantly share code, notes, and snippets.

@rjp
Created February 5, 2013 05:54
Show Gist options
  • Save rjp/4712542 to your computer and use it in GitHub Desktop.
Save rjp/4712542 to your computer and use it in GitHub Desktop.
Reliably run snowcam.sh at :00/:20/:40 seconds
boot=$((SECONDS % 20))
time=$(($(date +%s) % 20))
offset=$((20-(time-boot)))
echo "boot=$boot time=$time offset=$offset"
while [ 1 ]; do
while [ $(((SECONDS-offset) % 20)) -lt 18 ]; do sleep 1; done
while [ $(((SECONDS-offset) % 20)) -lt 19 ]; do echo >/dev/null; done
sleep 1
./snowcam.sh || exit
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment