Page 1 of 1

Running a PHP script as a CRON job on Linux

Posted: Fri Aug 30, 2002 10:46 pm
by dlgilbert
I have a small PHP script that I want to run periodically on my Linux server, but have yet to figure out how to do it.

The script has no terminal output. It simply updates a database with the status of some specified websites (it's a site monitor). I want to run it every 10 minutes or so, but if I use Lynx, the browser stays resident in memory instead of exiting once the script is done. When it runs again, another instance loads in memory. Not a good plan for something that will run every 10 minutes. :-)

So... is this something drop dead simple that I'm just missing or is there a funky trick to it?

Thanks in advance!

Posted: Fri Aug 30, 2002 11:38 pm
by volka
call the php interpreter directly
you crontab entry would be something like

Code: Select all

0-59/10 * * * *       /usr/bin/php $HOME/myscript.php >> $HOME/tmpout 2>&1

Or...

Posted: Sat Aug 31, 2002 4:50 am
by James Pelow
Or if you're doing it remotely use a cron job of curl or wget etc. to download the file from your http server.

-James