Cron job not working?

Discussion in 'macOS' started by Christo16, Mar 7, 2007.

  1. Christo16 macrumors newbie

    Joined:
    Jan 4, 2005
    Location:
    New York, NY
    #1
    Hello I have a mac os x server machine that I have setup a cron to run a php file using wget and cron doesn't seem to work. I have setup cron on other mac's before and they have all worked. Also I know wget works because I have tested it. Is there anything else I should try?
    I do crontab -e and enter this:
    Code:
    "10 1 * * * /usr/bin/wget -q localhost/cron.php"
    and I get
    crontab: installing new crontab
    chris:~ localhost$
    So it seems to have been installed correctly. Any ideas?
     
  2. rhoydotp macrumors 6502

    rhoydotp

    Joined:
    Sep 28, 2006
    #2
    "10 1 * * * /usr/bin/wget -q localhost/cron.php"

    should be:

    10 1 * * * /usr/bin/wget -q localhost/cron.php

    i assume that you have the qoutes. if not, then try running manually first
     
  3. Westside guy macrumors 601

    Westside guy

    Joined:
    Oct 15, 2003
    Location:
    The soggy side of the Pacific NW
    #3
    You've got a relative path in there (localhost/cron.php) - always use the absolute path. When the cron job tries to run, its base directory may not be where you think it is. If it's your own cron (not root's), and you don't have write access to where it's starting, that could cause the issue.
     
  4. rhoydotp macrumors 6502

    rhoydotp

    Joined:
    Sep 28, 2006
    #4
    the base dir by default is the user's $HOME (home directory). try this out:

    10 1 * * * /usr/bin/wget -q "http://localhost/cron.php" > /tmp/wget.log 2>&1
     

Share This Page