Problem with a cron job

When i am trying to open crontab throught command crontab -e. It is not opening?
OUTPUT:

# crontab -e
sh: vim: not found

The crontab file was not changed.

Please let me know how to open and edit it???

Maybe you need to change the value of EDITOR?

Try with this ..

$ export EDITOR=vi
$ crontab -e

thanks its working!!!
Can you tell me " eport=vi" it is the command for installing vi edtior??

  1. it works only if we have already installed it
  2. for exporting other editors also we do sme thing?(only if that is installed)

EDITOR is a variable that tells crontab what program to use to edit the user's crontab file. That program has to be installed, yes (hence your error about vim not found).

export makes the variable (EDITOR) available to things that you run from your shell (in this case the crontab program).

It wasn't necessary to export EDITOR in this case, as the variable was already exported, but that's another matter.

I think you need to modify ~/.bashrc to make that change permanent.

let me modify something in this post.

If you are on a "bash" shell then you can use the command

EXPORT EDITOR=vi

before running

crontab -e 

if you are on "tcsh" promt you should use

setenv EDITOR vi

before editing your cron .

Cheers.

I usually use crontab -l to check my cronlist and crontab -e to add/modify.

any difference running this under root user or a specific user account?

these commands are user specific..for every user the cron is different.

Also you can check whether the crontab file for particular user is exists or not, if exists,

ls -ltr /var/spool/cron/crontabs/<<userfile>>

then edit as below,

export EDITOR=vi
crontab -e
I think no difference ...