Solved

Cron Jobs Failing

Posted on 2004-10-26
460 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
Question by:lux_interior
    12 Comments
     
    LVL 13

    Expert Comment

    by:Caseybea
    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
    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
    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
     

    Author Comment

    by:lux_interior
    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
    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
    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
    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
    I've increased the points on this question as I really need a solution please.

    Lux
    0
     
    LVL 38

    Expert Comment

    by:yuzh
    Try:

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

    0
     

    Author Comment

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

    Author Comment

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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT Security CISA, CISSP & CISM Certification

    Master the advanced techniques required to protect network resources from external threats with the IT Cyber Security bundle. Built around industry best-practice guidelines, the IT Cyber Security bundle consists of three in-depth courses.

    Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
    The purpose of this article is to demonstrate how we can use conditional statements using Python.
    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…
    Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

    846 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

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now