Monday, February 20, 2012

Problems editing crontab

You ever go to edit the crontab file on  a server, enter the command 'crontab -e', and get a number back?  Yeah, happened to me today.  I su - into root to edit the crontab and get a number. 

It's because the default editor for crontab is 'ed'.  To get around this, at least temporarily, you can do the following to make vi the editor for crontab:

#EDITOR=vi
#export EDITOR

Now you can edit the crontab file using the crontab -e command.

And, yes, this is in bash shell.

Mike