Solved: Cron missing newline before EOF

Better Stack Team
Updated on May 4, 2022

Cause of the error

Cron expects a trailing newline character at the end of each line in the crontab. Editors like vim and nano add this character automatically.

This error may also happen when a crontab file is generated automatically and the generator failed to insert a newline character at the end of the crontab file.

Solution

Simply add a new line at the end of the crontab file. If the problem occurs frequently, it may be caused by the text editor. Check if your editor automatically adds a newline character or change your editor entirely.

Got an article suggestion? Let us know
Explore more
Licensed under CC-BY-NC-SA

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

We are hiring.

Software is our way of making the world a tiny bit better. We build tools for the makers of tomorrow.

Explore all positions →

Reliability is the
ultimate feature

Delightful observability tools that turn your logs & monitoring into a secret weapon for shipping better software faster.

Explore Better Stack