Cron problems

Hi, I am having a few problems with cron.

I have created a shell script (to rotate www logs - this works) and then did the following (as root)

#crontab -e
2 0 * * 3 /cron_scripts/wwwlogs.sh
?
w
?
q
#

crontab -l
entry not shown e.g. it did not show what I had just writern

I then relised that I had put the day in wrong anyway - I wanted it to run on thursday not wednesday. So I:

#vi /var/spool/cron/crontabs/root
entered line
:wq
# cat /var/spool/cron/crontabs/root
2 0 * * 4 /cron_scripts/wwwlogs.sh
#
#crontab -l
2 0 * * 4 /cron_scripts/wwwlogs.sh
#

I then re-started cron (by killing it and then re-running).

Now the cron job ran on wednesday not thurday - WHY?

I am running Solaris 5.6 on sparc

Warren.

What exactly does this mean? "kill -9 pid" followed by "/usr/bin/cron"?

/etc/init.d/cron stop
/etc/init.d/cron start

would have been legal.

Ummm. Must admit typed first and didn't think about the proper way to do it:

Kill PID OF CRON
/usr/sbin/cron

Warren

It sounds like crontab -e brought up the ed editor because it couldn't figure out what your default editor was.

If you set the EDITOR environment variable to vi, crontab -e should open the crontab file in vi, making editing that much easier.
:cool:

Cheers, I ran:
#set env EDITOR vi
(sorry if I have got this wrong - Solaris isnt my favourite flavour of UNIX)

then re-ran crontab -e and it still used the default editor.

As a note it also ran the script on Thursday (as it should do - I just have to figure out why it is running it on wednesday)

It probably should be
EDITOR=/usr/bin/vi
export EDITOR

I would stop and restart cron correctly. Sun's script will remove the fifo, a step which you omitted. I'm not sure how the fifo is used, but you could have left some garbage in the fifo which may have confused cron.

Everyone got a bit off the subject. Sooo.... You only specified it to run on wednesday. if you want it to run m-f you have to change it to 2 0 * * 1-5 /cron_scripts/wwwlogs.sh

crontab Entry Format
     A crontab  file consists of lines of six  fields  each.  The
     fields  are  separated by spaces or tabs. The first five are
     integer patterns that specify the following:

     minute (0-59),
     hour (0-23),
     day of the month (1-31),
     month of the year (1-12),
     day of the week (0-6 with 0=Sunday).