Linux – Is it bad to edit cron file manually

cronlinuxscheduled-task

It is usually instructed to introduce new cron jobs through command lines; but I found it easier (with a better control of current cron tasks) to manually edit (in text editor) the user cron file like /var/spool/cron/crontabs/root.

Is it dangerous to edit the file in text editor?

The comments in the default file is confusing. The first line says

# DO NOT EDIT THIS FILE - edit the master and reinstall.

But the fourth line says

# Edit this file to introduce tasks to be run by cron.

Best Answer

If you modify the user file under crontabs, it should work. However, there are two issues to take into consideration:

  1. If you mistyped the cron entry in the file, you will not be warned as opposed to using crontab -e command.
  2. You can not edit your user file under crontabs directly without login as root or using sudo. You will get permission denied error.

Edit

One more point to add. When you edit the file directly, you may be warned by the text editor if you opened the file twice (two users accessing the same file). However, the cron list will be overwritten when using crontab -e from two different shell sessions of the same user. This is another difference.