Wget in cron vs wget from ssh

software development


hey all:

so i have a cronjob that runs as

and it worked in the past (sending email/txt msg reminders for an events calendar at http://www.latinosfortexas.com/events).

this morning it sent me 6 reminder for an event tomorrow!

so i go looking, and i noticed at my root level i have lots of ‘rem24.php’ and ‘rem24.php.1’ etc files. i assumed then that wget is DLing them to the crontab location at my root (i assume) from their lft.com/path location.

to test this, tho i ssh in via putty, and command-lined:
wget -q http://path/to/rem24.php
BUT I DIDNT get copies appearing at the root.

so i guess 2 questions:
1)does wget from cron act different than wget in ssh? (if not, any ideas on why the multiple copies of the pointed to file?)

2)is there anyone with direct experience on the best way to invoke php from crontab? wget or lynx -dump advocates?? or??



yeah things are executed a little different by crontab than when you do it manually… try this instead of wget

  • 9 * * * /full/path/to/php /full/path/to/rem24.php >/dev/null 2>&1

If you compiled php yourself it would be something like

  • 9 * * * /home/username/lft.com/cgi-bin/php.cgi /home/username/lft.com/path/rem24.php >/dev/null 2>&1

Otherwise use the path for the version your site is set to use, you can find the paths here if needed.


hey manic thanks.

so a quick followup question:
the " >/dev/null 2>&1" is typed exactly like that “(space)>dev/null(space)2>(ampersand)1”

just want tomake sure its right, as i m not familar with the dev/null 2>1 concept. i ll google it,tho.

i ve seen other comments about chmod u+x. is this a prerequisite to the above?



so, in case anyone is reading…

the issue of multiple reminders (ie, the reminder script being invoked multiple times) was not around wget, but around:

  • 9 * * * * cronjobhere

the first * means run it every minute…doh.

i needed
0 9 * * * * cronjobhere

and it runs just once