43

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

warren
  • 18,369
  • 23
  • 84
  • 135
belaz
  • 595
  • 1
  • 5
  • 7

1 Answers1

68

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.

Zoredache
  • 130,897
  • 41
  • 276
  • 420
Ian C.
  • 1,233
  • 9
  • 11
  • 1
    "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
  • https://unix.stackexchange.com/q/749963 – buhtz Jun 27 '23 at 07:37