• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 475
  • Last Modified:

Cron Jobs Failing

I have a number of cron jobs set up via cpanel. I've verified cron is working by scheduling a call to url that sends an email.

The problem is whenever I make a call to a url that has anything more complicated that simply sending an email the job fails.

I'm using the following statemnet to call the url in the cron jobs:

/usr/bin/wget -nv --spider http://www.mydomain.com/script.asp

Does anybody have any ideas/suggestions on why this isn't working and perhaps a better syntax for calling the url?

Thanks

Lux
0
lux_interior
Asked:
lux_interior
  • 7
  • 3
  • 2
1 Solution
 
CaseybeaCommented:
Do you have any example cron output log(s) that reflect the job failing (and therefore, SOME type of error message?)

0
 
lux_interiorAuthor Commented:
That's the problem. The cron output is '200 OK' so it looks like the cron is running but the scripts are failing. If I run the scripts manually in the browser they're fine so the scripts work. I know cron is calling them ok too. That's why I can't figure out the problem.

Lux
0
 
CaseybeaCommented:
The best *guess* I can come up with at this point, without other information to see or view is a security issue, perhaps?

So my next question is--  are you setting up the cron jobs (and crontab entries) as a user, and can I assume the interactive testing of those scripts is ALSO as a user?

Do the scripts have the execute bit set?  (copy and paste the output of "ls-l" of the script directory)

Have you tried adding simple "echo" statements to the job(s), so that when cron is run, you get SOME sort of output?

0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
lux_interiorAuthor Commented:
The script that's casusing the main problem isn't mine so I can't show you the sript but there is out put being printed to the screen. Shouldn't this show in the cron email that gets sent to me? I mena the email that the cron daemon sends?

This is the script and as you can see it runs http://www.puntersclub.org/auto_schedules.php

The script is on a seperate box to the cron job scheduling it (don't ask me why - it's too complicated)

Any ideas?

Lux
0
 
CaseybeaCommented:
The script might not like a tty not being there, perhaps?

What is the cron entry in your crontab file?
0
 
lux_interiorAuthor Commented:
The line in cpanel is /usr/bin/wget -nv --spider http://www.puntersclub.org/auto_schedules.php

I asked the guy who's code it is to add calls to a simple function in the script. He had one at the top and one at the bottom and he gets both the emails but still it's not actually running and producing the results it does if you run it manually.

Very strange.

Lux
0
 
lux_interiorAuthor Commented:
Quick update. We tried an online scheduling servcie www.cronservice.co.uk and the sript ran as expected and the two emails arrived. So the script runs from the other box but not from this one. I'm sure it must be something wrong with the syntax?

Lux
0
 
lux_interiorAuthor Commented:
I've increased the points on this question as I really need a solution please.

Lux
0
 
yuzhCommented:
Try:

/usr/bin/wget --output-document=- -q  http://www.mydomain.com/script.asp

0
 
lux_interiorAuthor Commented:
should there be a space between the - and the - just before the last q?
0
 
lux_interiorAuthor Commented:
Got this as the response from cron daemon


--22:02:00--  http://www.puntersclub.org/auto_schedules.php
           => `--q'
Resolving www.puntersclub.org... done.
Connecting to www.puntersclub.org[67.29.152.155]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]

    0K                                                         971.68 KB/s

22:02:25 (971.68 KB/s) - `--q' saved [995]

Not sure what it means?

Lux
0
 
yuzhCommented:
It shoud have a space between - and -q.

where:  --output-document=-   # outpout to stdout, "-" is your computer screen
            -q                               # quiet

to run a remote script  http://www.mydomain.com/script.asp, you can also do:

/usr/bin/wget  -N -q http://www.mydomain.com/script.asp
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 7
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now