how to save crontab

how does one save changes in crontab? i am using vi editor. Issued crontab -e command on the prompt. however not sure how to save changes. :wq doesnt work. any idea....

If your EDITOR isn't set, then just type q to get back to the prompt. If EDITOR is vi, then hitting the escape key, :, wq should work.

I tried following
$ crontab -l
#00 20 * * * /u02/app/oracle/admin/PROD/scripts/db_bkup.ksh
#5,20,35,50 6-19 * * * /u02/app/oracle/admin/PROD/scripts/db_move_out_logs.ksh
#00 20 * * * /u02/app/oracle/admin/PROD2/scripts/db_bkup.ksh
#5,20,35,50 6-19 * * * /u02/app/oracle/admin/PROD2/scripts/db_move_out_logs.ksh

$ crontab -e
284
1 * * * * /u12/archive/rm_archive.sh
?
q
The crontab file was not changed.
$

EDITOR=vi doesnt help either. is it possible to locate the crontab file and write directly to it? thanks a lot

You need to set your EDITOR variable.

If you are using sh or ksh
$ EDITOR=vi
$ export EDITOR
$ crontab -e

If you are using csh
% setenv EDITOR vi
% crontab -e

If you are using some other type of shell, please post which one (although one of those two suggestions should work for other shells).

hi..thanks a lot. i was able to make changes. however its not running. how do I find out if cron even executed?

my entry looks like this.

1 * * * * /u12/archive/rm_arch.sh

now this should execute every minute.. but its not doing anything. thanks a lot.

That should run once an hour. Change the 1 to an asterisk for every minute.

it runs.. how can change my entry to run every half hour?

new entry:

          • /u12/archive/rm_arch.sh

its interesting SUN's website shows first entry is for minutes. why it didnt work when I put 1 in the first place?

old entry
1 * * * * /u12/archive/rm_arch.sh

thanks

1 * * * * /u12/archive/rm_arch.sh
Did you wait until 1 minute after the hour? That's when that would run - once an hour at 1 minute after. 12:01, 13:01, 14:01...if you want it to run every minute, then it should be

          • /u12/archive/rm_arch.sh

To run every half hour:
00,30 * * * * /u12/archive/rm_arch.sh

And check to see if crond is running - if it isn't then your jobs won't run either.
ps -ef|grep cron
or
ps -auwx|grep cron

crontab -l > mycrontab
vi mycrontab
crontab mycrontab

checked that my cron process is not runing. How can I start it?

try in linux
/sbin/service crond start
or
/sbin/service crond restart

i am not sure how to restart the cron process in Unix.
man cron can get more details...

maybe you can check the file /sbin/init.d/cron