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 not working

Discussion in 'General Discussion' started by seniorheff, Jun 18, 2006.

  1. seniorheff

    seniorheff Registered

    Joined:
    Jun 12, 2006
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    I am trying to setup a simple cron job to run a PHP script, but nothing seems to work. I have tried:

    1) * * * * * php /home/user/www/crontest.php
    2) * * * * * path_to_php /home/user/www/crontest.php
    3) * * * * * wget http://www.domain.com/crontest.php
    4) * * * * * lynx --dump http://www.domain.com/crontest.php

    All of the above commands work when I run them from the command line (the php script just sends an email to me), but nothing happend when I try to add it to the crontab. I have tried editing the crontab with #crontab -e from the command line, as well as creating a cron job in the cPanel interface. I think the crontab might now be running. Any ideas?

    Thanks.
     
    #1 seniorheff, Jun 18, 2006
    Last edited: Jun 18, 2006
  2. jackie46

    jackie46 BANNED

    Joined:
    Jul 25, 2005
    Messages:
    537
    Likes Received:
    0
    Trophy Points:
    0
    /etc/init.d/cron restart
     
  3. seniorheff

    seniorheff Registered

    Joined:
    Jun 12, 2006
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Still not working. I ran:
    /etc/rc.d/init.d/crond restart

    It worked the first time fine, but my cron job didn't run within 5 minutes. Then I tried it again and I got:
    crond: can't lock /var/run/crond.pid, otherpid may be 15562: Resource temporarily unavailable
     
  4. bmcpanel

    bmcpanel Well-Known Member

    Joined:
    Jun 1, 2002
    Messages:
    546
    Likes Received:
    0
    Trophy Points:
    16
    I had the same error after I rebooted in single user mode. I manually started everything, including cron, but cron logs indicated cron was not working. The only thing that would fix it is if I did a regular reboot. However, I didn't want to have to do a full reboot, so I searched for a solution on the web, google, cpanel, etc. and could find nothing.

    So, I surmised that there was some process that was not running that is a sort of co-dependency for cron. It was just a guess, but since I was in single user mode, I decided to check another server of mine that was running fine to see if I had forgottent to restart something. It turns out, yes, antirelayd and chkservd were not running.

    So, considering that starting cron was showing that it was running BUT nothing was getting logged in cron indicated it actually was not running, I decided to do the following before starting antirelayd and chkservd ......

    1. Attempt to stop cron
    [#root] service crond stop

    2. Look for a residual pid file if it exists.

    [#root] cd /var/run
    [#root] ls -a

    3. If you see a cron.pid file, remove it (remember, you stopped cron and the pid file should not be there!)
    [#root] rm cron.pid

    4. Now, make sure that the following are running.... (in case you started from single user mode)

    [root#] services antirelayd start

    [root#] services chkservd start

    5. Now, attempt to start cron...

    [root#] services crond start

    6. Check your cron log after a minute to see if cron is now logging output...

    [root#] tail /var/log/cron

    ------ I hope it works for you. I looked everywhere for a solution to this same problem and found none until I figured out the above.
     
Loading...

Share This Page