Re: Writing CRON jobs!
| From: | Ray | Date: | Tue, 27 Jan 2004 15:53:16 +0000 |
| Subject: | Re: Writing CRON jobs! | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-175933@lists.php.net to get a copy of this message | ||
On Tuesday 27 January 2004 07:13, Stuart wrote:
> Hamid Hossain wrote:
> > Is there any good reference on how to use CRON (I mean on the
> > net)?
> >
> > I need to fire some PHP pages at scheduled time daily or weekly,
> > ... so on.
>
> http://www.google.com/search?q=cron+tutorial+php
depending on how you need them to fire off
a) if cron is on the same machine as the php script, then write the
script as a command-line php script
http://www.php.net/manual/en/features.commandline.php
b) if cron is on a different machine, create a normal web php script
with some sort of security and use lynx -dump to call it from cron
lynx -dump https://user:pass@mymachine.com/iben1Bj7s1N/sEg4gIh6G.php
either way add the job to the /etc/crontab file
man 5 crontab
<minute> <hour> <day of month> <month> <day of week> <user>
<command>
ie
27 2 * * * bob php4 -q /usr/local/scripts/update.php
at 2:27am everyday, run 'php4 -q /usr/local/scripts/update.php' as
the user bob