Cron Jobs - Cpanel - And PhpAdsNew

  • engress
  • Newbie
  • Newbie
  • engress
  • Posts: 6

Post 3+ Months Ago

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/mainten ... enance.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.

Any help is greatly appreciated!
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Daemonguy
  • Moderator
  • Web Master
  • User avatar
  • Posts: 2700
  • Loc: Somewhere outside the box in Sarasota, FL.

Post 3+ Months Ago

First of all, what system type is this? Linux I presume; which distribution?
Second, that does not look like a valid cron time, here's a part of 'man 5 crontab';
Code: [ Select ]
     field     allowed values
      -----     --------------
      minute    0-59
      hour     0-23
      day of month 1-31
      month     1-12 (or names, see below)
      day of week  0-7 (0 or 7 is Sun, or use names)
  1.      field     allowed values
  2.       -----     --------------
  3.       minute    0-59
  4.       hour     0-23
  5.       day of month 1-31
  6.       month     1-12 (or names, see below)
  7.       day of week  0-7 (0 or 7 is Sun, or use names)


What times are you trying to run it?
I have no idea how those panels work but it looks as though it is trying to set up the entire line as the shell command to be executed. In other words, it is seeing the first 0 as a shell command instead of part of the crontab entry. First thing, figure out how to enter a crontab entry.
Then figure out a proper crontab entry.
Then create a properly designed command syntax; This one makes no sense to me.
I would instead, create a shell command that has all that information in it. This way you could modify it at will, without entering in a new crontab entry.

Say, maint.sh; which contains:
Code: [ Select ]
wget -q http://www.server.com/phpAdsNew/maintenance/maintenance.php

Then using a syntactically correct crontab, call it thusly (say run five min after midnight every day);
Code: [ Select ]
5 0 * * * /home/bin/maint.sh >/dev/null 2>&1


Then, as previously mentioned, you may edit maint.sh at whim.
The one thing about your command syntax -- and why mine did not match yours -- which confused me would have been the request for -q (quiet, no output) with the -O (for direct output to a file, which was never designated anyway) followed by a stray '-'. I would say, run 'man wget' from the command window if possible to understand the command syntax. If you want output sent to a file, don't quiesce the output with a -q.

If you do not have command line access to a linux/unix machine, I am sure it is available on the net someplace; I can also post it as it's not all that long.

Cheers.
  • engress
  • Newbie
  • Newbie
  • engress
  • Posts: 6

Post 3+ Months Ago

Thanks a lot for your input! The dev/null was necessary on mine, also. I'm surprised that wasn't covered in the phpadsnew docs. I was using a web interface on a linux server. All the asteriks at the beginning of the command is automated by the interface and was getting everything screwed up.

Heres the command that made it work:

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

Next time I'm having issues I will have to remember to check the forums. I have a tendency to try and solve everything myself. Not anymore.

Take care!

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 50 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.