Results 1 to 4 of 4

Thread: Cron not working

  1. #1
    Registered User
    Join Date
    Jun 2006
    Posts
    2

    Default Cron not working

    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.
    Last edited by seniorheff; 06-18-2006 at 01:40 AM.

  2. #2
    BANNED
    Join Date
    Jul 2005
    Posts
    537

    Default

    /etc/init.d/cron restart

  3. #3
    Registered User
    Join Date
    Jun 2006
    Posts
    2

    Default

    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. #4
    Member bmcpanel's Avatar
    Join Date
    Jun 2002
    Posts
    546

    Default

    Quote Originally Posted by seniorheff
    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
    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.

Similar Threads

  1. Cron won't working
    By KraKaZabRa in forum cPanel & WHM Discussions
    Replies: 5
    Last Post: 07-02-2008, 03:09 PM
  2. cron not working
    By Domenico in forum cPanel & WHM Discussions
    Replies: 3
    Last Post: 09-27-2005, 03:26 PM
  3. cron not working
    By The MAzTER in forum cPanel & WHM Discussions
    Replies: 8
    Last Post: 02-07-2005, 03:44 PM
  4. Cron Job not working
    By sinclac in forum cPanel & WHM Discussions
    Replies: 0
    Last Post: 08-02-2004, 07:14 PM
  5. cron manager not working
    By madmac in forum cPanel & WHM Discussions
    Replies: 5
    Last Post: 05-30-2004, 12:43 PM