Reputation: 283
I have had several Debian servers and always edited cronjobs in this way:
crontab -e and Ctrl+x
Just got a new server and can not do it in this way anymore.
When I enter crontab -e, the file opens but I can't write anything. I can move cursor up and down but can't write. I even can not exit from this file because Ctr+x doesn't work.
When I open a file there is some information and the rest empty lines contain tildes ~ in the beginning of each line.
Any ideas how can I edit this file?
Thanks.
Upvotes: 11
Views: 15804
Reputation: 1166
You need to turn on insert mode. After entering crontab -e
, press i to turn on insert, enter your full line, press esc to finish entering, and then hold down shift and press z twice to save the file. This is how I managed to do it in vi/vim
Upvotes: 31
Reputation: 4843
As one other person has suggested, vim is obviously the default editor on your new server. You can test this by running
EDITOR=pico crontab -e
Substituting whatever is your actual preferred editor (sounds like it may be nano or pico). If that works, you should try one of the following:
update-alternatives --config sensible-editor
You can then choose the default editor for all users (they can override it individually by doing option 1).
Upvotes: 9
Reputation: 2080
~
would suggest that you are now editing your crontab using vi/vim instead of your usual editor
so Ctrl-X wont work, try Esc :wq
Upvotes: 2
Reputation: 932
Do you have the right permissions? maybe you should open it as root user if not.
check it doing this:
ls -all $(which crontab)
if not you can change them..take a look here too..maybe you find something more!
hope it helps.
Upvotes: -1