Instantly share code, notes, and snippets.

Embed
What would you like to do?
cron for bot
#!/bin/bash
echo `date` >> /tmp/autofaves.log
maxdelay=$((16*60)) # 16 hours from 2am to 11pm (in minutes)
for ((x=1; x<=24; x++)); do
# pick random delay for each of the 24 runs
delay=$(($RANDOM%maxdelay))
# background a subshell to wait, then run
(sleep $((delay*60)); cd /apps/xdaysb4nba && ruby fave.rb || echo "ERROR!") &
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment