Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can you put a comment on the same line as a cron job?


* 19 * * * lnxuser rm /home/lnxusr/edi/logs/mcfg204_`date -d -8days +\%Y\%m\%d`.log #THIS IS TO WIPE A 204 LOG THAT IS OLDER THAN A WEEK

I tried it on a working crontab on an Ubuntu system and it stopped processing crobjobs. Nothing in /var/log/syslog showed any kind of status (only the last successful run). When I put the comment on a line of its own and restarted cron daemon, the issue was solved.

This works fine in bash scripts, so I was a bit shocked by this since I thought crontab was just a script itself.

share|improve this question
up vote 1 down vote accepted

Well, if it didn't work, then obviously you cannot do it. :)

On a more serious note, I always put comments on separate lines in crontabs. It is essentially guaranteed to work regardless of which cron daemon happens to be in use, and I find it to be much more clear since the comment comes before what it comments.

Remember that there are multiple different cron implementations (a quick check in Debian stable/main shows half a dozen or so), and they may each have slightly different semantics, particularly in such edge cases.

share|improve this answer
Well I wasn't sure & wanted to see if anyone else could give a reference confirming that it shouldn't be done or test it themselves – gregg Apr 3 '13 at 15:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.