Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Cron Jobs Failing

Posted on 2004-10-26
14
Medium Priority
?
469 Views
Last Modified: 2013-12-16
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
Comment
Question by:lux_interior
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 3
  • 2
14 Comments
 
LVL 13

Expert Comment

by:Caseybea
ID: 12415426
Do you have any example cron output log(s) that reflect the job failing (and therefore, SOME type of error message?)

0
 

Author Comment

by:lux_interior
ID: 12415817
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
 
LVL 13

Expert Comment

by:Caseybea
ID: 12416517
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
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 

Author Comment

by:lux_interior
ID: 12416577
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
 
LVL 13

Expert Comment

by:Caseybea
ID: 12421724
The script might not like a tty not being there, perhaps?

What is the cron entry in your crontab file?
0
 

Author Comment

by:lux_interior
ID: 12425210
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
 

Author Comment

by:lux_interior
ID: 12425327
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
 

Author Comment

by:lux_interior
ID: 12426537
I've increased the points on this question as I really need a solution please.

Lux
0
 
LVL 38

Expert Comment

by:yuzh
ID: 12429563
Try:

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

0
 

Author Comment

by:lux_interior
ID: 12429597
should there be a space between the - and the - just before the last q?
0
 

Author Comment

by:lux_interior
ID: 12429661
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
 
LVL 38

Accepted Solution

by:
yuzh earned 800 total points
ID: 12430500
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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

596 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question