That's right boys & girls, its quiz time. Get out your brains and prepare to use them.
The file below is a standard cronjob file, hiding in /etc/cron.d. Can anyone point out to me what the bug is? Assume that some_script exists and produces output. And yes there is a bug in there. I promise.
55 14 * * * root sleep $(($RANDOM % 60)); logger -p local3.info "some script"; OUT=`/opt/sbin/some_script 2>&1` ; logger -p local3.info $OUT;
Unless someone posts a comment with the correct answer( and earns themselves a virtual beer), I will share the answer next week.

From the Tagged SiteOps Team
You need to escape the '%' in the sleep section because % means newline in crontabs.
Cheers,
-Dave
Hey Dave, Thanks for posting
Hey Dave,
Thanks for posting the right answer. Happy Easter to you and yours, and I'll send you that virtual beer as soon as I can.
For anyone who is interested in the details, if you run:
man 5 crontabyou'll eventually see this paragraph:
Percent-signs (%) in the command, unless escaped with backslash (\), will be changed into newline characters, and all data after the first % will be sent to the command as standard input.
Happy Easter everyone!
Post new comment