how can I check a cron job is running?

Status
Not open for further replies.

tropic81

New Member
Messages
20
Reaction score
0
Points
0
Hi all,

I've never used acon jobs before.
I added one, how can I check it's running ok?

*/10 * * * * wget http://tropicalfishnet.x10.mx/wp-content/plugins/buddystream/import.php -O /dev/null -q

Does that look ok?
If I follow the link it does what it's meant to but the cron job doesn't seem to be running.

Thanks.

---------- Post added at 06:13 PM ---------- Previous post was at 04:49 PM ----------

I think wget is wrong. trying again with usr/bin/php /home/tropic81/public_html//wp-content/plugins/buddystream/import.php -O /dev/null -q set to run every 10 mins
 
Last edited:

tropic81

New Member
Messages
20
Reaction score
0
Points
0
Thanks for the reply :)
This is the first time I've used cron jobs and I'm not sure if I need curl or wget because the file is on my server.
I'm very unsure of the syntax and what path I should be using.

Many thanks,

Paul.

---------- Post added at 06:35 PM ---------- Previous post was at 06:27 PM ----------

Ok. I am now running usr/bin/curl -s -S "http://tropicalfishnet.x10.mx/wp-content/plugins/buddystream/import.php "-O /dev/null -q

every 5 mins just to test. I'll knock this back to ten minutes once I have it working.

Does this look ok?

---------- Post added at 06:37 PM ---------- Previous post was at 06:35 PM ----------

I'm still not convinced. I want to execute the .php file, from what I've read curl will download it and I believe with what I have enterd as a command it will download it to null. am I wrong?

Many thanks.
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
Why were you using wget in the first place (it retrieves the page same as going to the page via your browser)?

And if you shove any output into the null device, how do you have any record of the script running?
 

tropic81

New Member
Messages
20
Reaction score
0
Points
0
I was advised elsewhere to use wget. I have no idea about unix commands.
it might be easier if I tell you what I am trying to achieve?

I want to execute the file at "http://tropicalfishnet.x10.mx/wp-content/plugins/buddystream/import.php"

every ten minutes.

The file updates records in my database.
If I run the file manually it does its job.

I sent it to null so I don't build up a big log file which I can quite easily see happening if I send it to a log.

I don't really know what I'm doing to be honest which is why I'm asking for help.

Many thanks for your advice.

Paul.
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
With logging:

Code:
/usr/bin/php -q  /home/igor/public_html/test.php >>/home/igor/public_html/test_log.txt 2>&1


Will put the output of the script into test_log.txt. That will help debuggin, etc and will show you the cron job is running. If the output is short, the log file does not grow too fast and you can manually delete/trim it every so often.

Without logging:

Code:
/usr/bin/php -q  /home/igor/public_html/test.php

But, if the script throws an error, or if you mistyped the script name or the path to php, there is no way to tell. It fails silently (the cPanel system to notify you by mail is disabled due to it swamping the mail server )
 

tropic81

New Member
Messages
20
Reaction score
0
Points
0
Thanks, I'll give that a go :)

---------- Post added at 07:11 PM ---------- Previous post was at 07:01 PM ----------

THANK YOU!!

That works great.
I'm adding you to my list of heros.
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
Start with the logging version. Every 10 mins.

Add another cron job without logging. Once a year.

Once you are satisfied, make logging once a year and non-logging every 10 mins.

If you ever wonder if the cron is running or making errors, flip them back and check if the log grows.
 

tropic81

New Member
Messages
20
Reaction score
0
Points
0
Thanks again :)

---------- Post added at 09:13 PM ---------- Previous post was at 07:21 PM ----------

all working great. closing the thread.
 
Status
Not open for further replies.
Top