SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2003
    Location
    United States
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cron Jobs - Cpanel - And PhpAdsNew

    I am having a bit of trouble configuring a cron job for the maintenance script on PhpAdsNew.

    I contacted my host and he told me to use wget.

    Command looks like this (in the PhPAdsnew docs):

    0 * * * * wget -q -O - http://www.server.com/phpAdsNew/main...aintenance.php

    When I run the cron (standard experience level on cPanel Pro 1.0 (RC2)I get back this:

    /bin/sh: line 1: 0: command not found

    Any suggestion? Or at least where I can find docs about wget? Cpanel documentation scarcely covers the use of cron. Do the permissions on maintenance.php need to be set a certain way for cron to be able to access it?

    Any help is greatly appreciated!

  2. #2
    SitePoint Wizard HarryR's Avatar
    Join Date
    Dec 2004
    Location
    London, UK
    Posts
    1,376
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The problem your having is because it seems to be executing the entire line, instead of just the command, thats why your getting the '0' cannot be found message.

    The '0 * * * *' prefix is used when entering commands directly into the crontab, they describe when the command should be run (in this case, once a minute).

    If your maintaining cron jobs through a web interface (I think this may be the case with CPanel.. but I haven't used cpanel in ages), then try just enternig the command part of the job: e.g.

    wget -q -O /dev/null http://www.server.com/phpAdsNew/mai...maintenance.php

    You can find more information about wget by reading the 'man' pages for the command.

    An extract is as follows for the two parameters your using:
    -q
    --quiet
    Turn off Wget's output.

    -O file
    --output-document=file
    The documents will not be written to the appropriate
    files, but all will be concatenated together and writ*
    ten to file. If file already exists, it will be over*
    written. If the file is -, the documents will be
    written to standard output. Including this option
    automatically sets the number of tries to 1.

    In this case i'm using /dev/null for the output, which essentially does nothing with anything the script outputs apart from discard it.

    Regards.

    In future.. first

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2003
    Location
    United States
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks so much, HarryR! I should have noticed the correlation between the asteriks and hours and minutes. Maybe I have been working too hard. Your command:

    wget -q -O /dev/null http://www.server.com/phpAdsNew/mai...maintenance.php

    Worked the magic I needed.

    Take care.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •