Cron problems


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Cron problems
# 1  
Old 11-28-2001
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.
# 2  
Old 11-28-2001
Re: Cron problems

Quote:
Originally posted by warrend
I then re-started cron (by killing it and then re-running).
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.
# 3  
Old 11-28-2001
Ummm. Must admit typed first and didn't think about the proper way to do it:

Kill PID OF CRON
/usr/sbin/cron

Warren
# 4  
Old 11-28-2001
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.
Smilie
# 5  
Old 11-29-2001
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)
# 6  
Old 11-29-2001
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.
# 7  
Old 12-07-2001
Re: Cron problems

Quote:
Originally posted by warrend
Hi, I am having a few problems with cron.

#crontab -l
2 0 * * 4 /cron_scripts/wwwlogs.sh
#

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

Warren.
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

Code:
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).

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Problems with set up Cron

Hi I want to set up a cron for every 15 minutes between some hours. Can you tell whether the below command will work. Getting confuse because my time goes from night to next day morning. i want to setup 8 PM to next day 10 AM. */15 20-10 * * * sh abc.sh (1 Reply)
Discussion started by: raju2016
1 Replies

2. UNIX for Dummies Questions & Answers

Execution Problems with Cron

Good evening, ive got this cron to be run: if i run this manually it doesnt work,it takes me to the prompt again /export/app/CO/opge/scr/Informe_parametros_colombia.ksh >/dev/null 2>&1 here is the code fragment: coopge@coopge: opge PRODUCCION>more... (1 Reply)
Discussion started by: alexcol
1 Replies

3. Shell Programming and Scripting

Execution problems with cron

I am new to creating crontab file , i just wrote below (40 19 * 3 * /root/maths/practisecron.sh), the script just prints "Hi". When ever i save the above file i am getting this . # crontab -e crontab: installing new crontab Can you please check where it went wrong.. (1 Reply)
Discussion started by: vkiyv05
1 Replies

4. UNIX for Dummies Questions & Answers

cron problems

I am trying to setup a cron that runs a script to update my ip for my domain name every time I reboot and checks if my ip changes every 5 minutes and if it does then I update it. I am running Ubuntu server 12.04. The file /etc/cron.d/ipupdate contains # # # Run ipupdate # # /5 * ... (3 Replies)
Discussion started by: Bros2
3 Replies

5. Ubuntu

Problems with a .sh file in cron

Hi guys. This is my first post so bear with me. I'm trying to get cron to run a shell script in my home directory (/home/server) that checks the temperature of my HDD. The script works fine, however I can't run it in cron. I've checked the syslog and I have only seen two errors: - Exited with... (11 Replies)
Discussion started by: Rautoner
11 Replies

6. UNIX for Dummies Questions & Answers

Execution Problems with Cron

Hi friends, today i created a cron job , registered the crontab file associated but dont know why the cron is not getting executed at the right time.?? content of Crontab file : 21 15 * * * /subrat/myt i wanted to execute the script myt on 15:21 PM of everyday. the script myt... (2 Replies)
Discussion started by: paras.oriental
2 Replies

7. Shell Programming and Scripting

Execution Problems with Cron

Hi, I have written a shell script to transfer files to a SFTP server passing the filername, source and dest directory as parameters and it runs well. :) I want to schedule this script to run periodically using a cron job. root@pingu # cat /etc/crontab SHELL=/bin/bash... (1 Reply)
Discussion started by: chetancrsp18
1 Replies

8. UNIX and Linux Applications

Execution Problems with Cron

Hi all!! I have a nerve-wracking concept (probably for me!!) which is not understood. My crontab entry looks this way. 33 09 22 3 * /home/myexp.sh "Bgp4 ALL" >/dev/null 2>&1 But cron gets started occasionally. Sometimes it does. Sometimes it does not. And sometimes it hangs in the middle (I... (1 Reply)
Discussion started by: dhivyasuresh
1 Replies

9. Programming

execution problems with cron

how to store a date into file? and how we can access date from the file? ---------- Post updated at 06:09 AM ---------- Previous update was at 06:08 AM ---------- how we can store date in file? (1 Reply)
Discussion started by: causalmodi777
1 Replies

10. UNIX for Dummies Questions & Answers

cron problems

Hi there, this time a have a other problem :) i will start a script over the cron. if i start the script manual (per command) it works without any problems, but over the cron it doesent work. my cron looks like this: 26 15 * * * /path/scriptname.sh 2> /path/error.log there is no... (3 Replies)
Discussion started by: scotty
3 Replies
Login or Register to Ask a Question