LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 12-11-2003, 10:34 PM   #1
brentos
Member
 
Registered: Nov 2003
Distribution: Fedora Core3, RHEL3,4
Posts: 92

Rep: Reputation: 15
Cron job does not run


Hello Everyone, Hoping you might be able to help me with something

I need to make a cron job that will run a php script to reset a php based ranking system, I am using wget to run the actual php and I am sure my command works cause I have just typed it at the command line and the ranking system reset.

But the thing is the job should run every 10 minutes so I made a script placed it in /etc/cron.d and set its permissions to 755 like all of the other scripts that are in that directory, but still it will not do it.

Here is what is in the file

#MNTSL : Rerank (Every 10 minutes)
*/10 * * * * root /usr/bin/wget .....someother stuff

The wget command is not the problem cause as I have said I tested it, but it just will not run as scheduled every 10 minutes, it will never run.

Any ideas
 
Old 12-12-2003, 01:56 AM   #2
stuNNed
Member
 
Registered: Aug 2003
Distribution: Gentoo/Ubuntu
Posts: 134

Rep: Reputation: 15
try creating a cron job for whatever user you would normally run the wget command with, i.e. log in as that user and run:

crontab -e

then put your cron entry in there w/out the 'root' in the above line, see if that works
 
Old 12-12-2003, 05:01 AM   #3
titanium_geek
Senior Member
 
Registered: May 2002
Location: Melbourne Australia
Distribution: it died/ macosx
Posts: 2,478

Rep: Reputation: 50
I had a problem very much like yours. This thread should help:
http://www.linuxquestions.org/questi...highlight=cron
 
Old 12-12-2003, 09:47 AM   #4
Blinker_Fluid
Member
 
Registered: Jul 2003
Location: Clinging to my guns and religion.
Posts: 682

Rep: Reputation: 63
I've never seen the */10 syntax. does it work if you change it to something more traditional like:
0,10,20,30,40,50 * * * * /usr/bin/wget .....someother stuff
leave out the root too...
Also check mail for the user that you created the cron file for you probably have some error messages that might help.

Last edited by Blinker_Fluid; 12-12-2003 at 09:48 AM.
 
Old 12-12-2003, 12:01 PM   #5
brentos
Member
 
Registered: Nov 2003
Distribution: Fedora Core3, RHEL3,4
Posts: 92

Original Poster
Rep: Reputation: 15
I will try changing it to a more standard method that you suggest, I just used that cause one of the other scripts in that directory has the same format for its 10 minute run so I just thought it was ok.

Now do I have to do anything to tell cron that the script in in /etc/cron.d?
The Redhat docs just said it checks it every minute, but how can I tell?
 
Old 12-12-2003, 12:22 PM   #6
Technoslave
Member
 
Registered: Dec 2003
Location: Northern VA
Posts: 493

Rep: Reputation: 30
Using */10 for every 10 minutes or */5 for every works just fine...For what it's worth.

I usually create a seperate directory that I put home made scripts in to.

If you log in as root and type this

crontab -e

*/10 * * * * /etc/cron.d/name_of_script

Where name of script is executable, and the script will contain the wget stuff.

If you want, you can just have

*/10 * * * * wget the_rest_here.

But I prefer to have things in scripts.
 
Old 12-12-2003, 02:37 PM   #7
Blinker_Fluid
Member
 
Registered: Jul 2003
Location: Clinging to my guns and religion.
Posts: 682

Rep: Reputation: 63
Quote:
Originally posted by brentos
I will try changing it to a more standard method that you suggest, I just used that cause one of the other scripts in that directory has the same format for its 10 minute run so I just thought it was ok.

Now do I have to do anything to tell cron that the script in in /etc/cron.d?
The Redhat docs just said it checks it every minute, but how can I tell?
You could check to see if cron is running every minute by doing the following:
crontab -e
add the following line:
* * * * * date >> /tmp/cron_test.junk
wait a minute or two then check the /tmp/cron_test.junk file
--> cat /tmp/cron_test.junk
Fri Dec 12 13:35:00 MST 2003
Fri Dec 12 13:36:01 MST 2003

You also should be able to do a ps -ef | grep cron and see the crond process running...

Oh yea you might want to comment out the line with a # if you don't want to make a big file when you are done...
BTW thanks for the info about the /10 option I didn't know that one...

Last edited by Blinker_Fluid; 12-12-2003 at 02:39 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
unable to run cron job fahad26 Linux - General 3 06-30-2005 01:51 AM
Cron job to run every monday wednesday and friday...? init Linux - General 4 07-29-2004 11:24 AM
how to run this cron job ashley75 Linux - General 5 05-24-2004 11:20 AM
Did my Cron job run? ryedunn Linux - Newbie 2 02-25-2004 08:59 AM
how to set cron job to run every 5 mins? gsbarry Linux - General 7 05-28-2003 12:30 PM


All times are GMT -5. The time now is 09:07 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration