Can I use the C++/Java-style /* */ syntax to multi-line comments in the crontab file?


The only comment character allowed in a crontab file is #. So you need to do:

# This is line 1
# This is line 2
0 0 * * * /usr/bin/magiccronjob

Edit: I believe it's man 5 crontab to see the details about crontab syntax.

  • "Blank lines and leading spaces and tabs are ignored. Lines whose first non-space character is a pound-sign (#) are comments, and are ignored. Note that comments are not allowed on the same line as cron commands, since they will be taken to be part of the command. Similarly, comments are not allowed on the same line as environment variable settings." – enharmonic Jan 30 '20 at 17:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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