Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
madphilosopher
· 3y ago · 0 comments
Further to this, I also put the following snippet in front of my web-scraping cron jobs so they start at a random time between the minute boundaries:
perl -le 'sleep rand 60';
It's the most compact code I could find to do the job.
Comments
[–]
drougge
3y ago
If you're using a somewhat modern shell there is $RANDOM which gives you a 15 bit random number. So e.g.
sleep $((RANDOM / 546))
but I guess most cron jobs run with an extremely conservative shell that might not have it.