The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Cron job not working when set up through CPanel?

Discussion in 'General Discussion' started by avara, Jul 10, 2002.

  1. avara

    avara Well-Known Member

    Joined:
    Oct 28, 2001
    Messages:
    90
    Likes Received:
    0
    Trophy Points:
    6
    Cron jobs are working fine when set up via the command line, however I have someone who set up one from the CPanel control panel like this:

    5 * * * * GET http://domain.com/path/cron_script.php & /dev/null

    Why isn't this working, and how do I make it work?
     
  2. awsol

    awsol cPanel Test Bitch

    Joined:
    Feb 8, 2002
    Messages:
    591
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Boston MA
    LOL avara I'm actually using the same exact script. I use the cron job through cPanel with no problems. Make sure you have the paths right.

    PS: This is an important thing to do with that script so make sure you do.

    Put a htaccess file in the directory and link to it how I show you below.

    http://USER:PASS@domain.com/path/cron_script.php & /dev/null

    That script can overload a server, If somebody keeps refreshing the page every second you will have problems.
     
  3. awsol

    awsol cPanel Test Bitch

    Joined:
    Feb 8, 2002
    Messages:
    591
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Boston MA
    LOL avara I'm actually using the same exact script. I use the cron job through cPanel with no problems. Make sure you have the paths right.

    PS: This is an important thing to do with that script so make sure you do.

    Put a htaccess file in the directory and link to it how I show you below.

    http://USER:PASS@domain.com/path/cron_script.php & /dev/null

    That script can overload a server, If somebody keeps refreshing the page every second you will have problems.
     
  4. avara

    avara Well-Known Member

    Joined:
    Oct 28, 2001
    Messages:
    90
    Likes Received:
    0
    Trophy Points:
    6
    I figured out why it wasn't working: I followed the instructions in the cpanel manual at www.cpanel.net/docs/cpanel

    Should have been:

    * * * * * GET etc etc

    Oops ;)
     
  5. Radio_Head

    Radio_Head Well-Known Member

    Joined:
    Feb 15, 2002
    Messages:
    2,051
    Likes Received:
    1
    Trophy Points:
    38
    When I insert from the CPanel this:

    * * * * * GET http://domain.com/path/cron_script.pl & /dev/null

    it doesn't work ... please help !
     
  6. Marty

    Marty Well-Known Member

    Joined:
    Oct 10, 2001
    Messages:
    630
    Likes Received:
    1
    Trophy Points:
    18
    I wrote that script that you are all trying to cron. :)

    Here is the cron that I use:

    */5 * * * * lynx -dump http://domain.com/path/cron_script.php & /dev/null

    First, have just 5 in the first column of the cron, only runs it once per hour at 5 minutes after the hour. */5 runs it every 5 minutes beginning at 5 minutes after the hour.

    I just the lynx text browser to browse to the cron script. I agree with using htaccess to protect that directory so that you would then use:

    */5 * * * * lynx -dump http://username:password@domain.com/path/cron_script.php & /dev/null
     
  7. Marty

    Marty Well-Known Member

    Joined:
    Oct 10, 2001
    Messages:
    630
    Likes Received:
    1
    Trophy Points:
    18
    [quote:6b377e7b44][i:6b377e7b44]Originally posted by Radio_Head[/i:6b377e7b44]

    When I insert from the CPanel this:

    * * * * * GET http://domain.com/path/cron_script.pl & /dev/null

    it doesn't work ... please help ![/quote:6b377e7b44]

    It is cron_script.php not cron_script.pl.
     
  8. Radio_Head

    Radio_Head Well-Known Member

    Joined:
    Feb 15, 2002
    Messages:
    2,051
    Likes Received:
    1
    Trophy Points:
    38
    [quote:a2dcd84b77][i:a2dcd84b77]Originally posted by Marty[/i:a2dcd84b77]

    [quote:a2dcd84b77][i:a2dcd84b77]Originally posted by Radio_Head[/i:a2dcd84b77]

    When I insert from the CPanel this:

    * * * * * GET http://domain.com/path/cron_script.pl & /dev/null

    it doesn't work ... please help ![/quote:a2dcd84b77]

    It is cron_script.php not cron_script.pl.[/quote:a2dcd84b77]


    No , my problem is running a cronjob on a perl file . Is it permitted ?
     
  9. Marty

    Marty Well-Known Member

    Joined:
    Oct 10, 2001
    Messages:
    630
    Likes Received:
    1
    Trophy Points:
    18
    Yes, you should be able to cron a perl script.

    try

    * * * * * usr/bin/perl /absolute/path/cron_script.pl & /dev/null
     
  10. moronhead

    moronhead Well-Known Member

    Joined:
    Aug 12, 2001
    Messages:
    706
    Likes Received:
    0
    Trophy Points:
    16
    Guys, can someone tell what that php script is all about? What does it do, can we have the pleasure to make an acquaintance? etc etc
     
  11. Marty

    Marty Well-Known Member

    Joined:
    Oct 10, 2001
    Messages:
    630
    Likes Received:
    1
    Trophy Points:
    18
    It is a network status script. It is a free gpl's script that can be found at http://scripts.tlcwe.com at the bottom of the page. It is a really a cosmetic feature for a webhost to display the status of all the servers on their network. I will not use my own installation as an example so that I don't appear to be advertising, but you can see it in action here, http://hostmatters.com/netstatus

    It is fully templated and has a section for announcments, so it could be used on an offnetwork server to allow clients to get a status announcement if you the server with your hosting site were to ever go down.
     
  12. moronhead

    moronhead Well-Known Member

    Joined:
    Aug 12, 2001
    Messages:
    706
    Likes Received:
    0
    Trophy Points:
    16
    Marty, are you the creator of Kbase?
     
  13. Radio_Head

    Radio_Head Well-Known Member

    Joined:
    Feb 15, 2002
    Messages:
    2,051
    Likes Received:
    1
    Trophy Points:
    38
    [quote:7c6eb7eba9][i:7c6eb7eba9]Originally posted by Marty[/i:7c6eb7eba9]

    Yes, you should be able to cron a perl script.

    try

    * * * * * usr/bin/perl /absolute/path/cron_script.pl & /dev/null[/quote:7c6eb7eba9]


    I tried it , but it absolutely don't work . Are there particulary requirements to activate a cron job ? . For example ..
    the file and directory where the file reside must have particular permissions ?
     
  14. Marty

    Marty Well-Known Member

    Joined:
    Oct 10, 2001
    Messages:
    630
    Likes Received:
    1
    Trophy Points:
    18
    Radio_Head,

    Normal permissions required. Actually, less permission than what is required to execute through a broswer. I don't know why you are not able to make it work.

    moronhead,

    Yes, I am the author of KBase.
     
Loading...

Share This Page