Skip to content

Instantly share code, notes, and snippets.

@katpadi
Created September 26, 2014 20:01
Show Gist options
  • Save katpadi/425ea20db85d141e4328 to your computer and use it in GitHub Desktop.
Save katpadi/425ea20db85d141e4328 to your computer and use it in GitHub Desktop.
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