The POSIX standard requires a trailing newline character on every line of a text file. Text editors like
vim add this automatically, and cron expects it.
The last line of your crontab does not end with a newline character. Because it's added automatically by text editors, if you are encountering this error it's possible your crontab file is parsed or generated by an automated process that failed to insert the newline or mistakenly stripped it from the end of your file.
Here is an excerpt from the cron manual explaining this requirement:
Cron requires that each entry in a crontab end in a newline character. If the last entry in a crontab is missing the newline, cron will consider the crontab (at least partially) broken and refuse to install it.
Correct this error simply by adding a blank line at the end of your crontab. If your crontab is generated automatically, review the generation process to ensure trailing newline characters are always added and are not incorrectly stripped.
Our software, CronitorCLI, includes the free tools we always wished we had.
Scan your system and list every cron job in seconds using
cronitor list. Run any cron job instantly using
Get Started Free