crontab -e. Added entries but no /etc/crontab
I did edit /etc/crontab using corntab -e.
I have only one entry
After save contab is not created despite the message.
To be honest I have no idea what to do. I simply want to create a simple daily job.
Second question. How can I change the editor for crontab -e
?
The command crontab -e
does not edit the system-wide crontab file /etc/crontab
, it edits a user-specific file in /var/spool/cron/crontabs
. The editor used may be changed using the EDITOR
or VISUAL
environment variable ex.
EDITOR=/bin/nano crontab -e
You can confirm that you changes have installed by listing the crontab file, using crontab -l
.
If you want to place your job in /etc/crontab
instead, you would edit it like any other system file ex.
sudoedit /etc/crontab
or (to use the nano
editor explicitly)
sudo nano /etc/crontab
but remember that the format of this file is slightly different - in particular, because the file is not user-specific it requires an additional (sixth) field containing the username under which to run each job.