how do i run a cron job ?
Moderator: General Moderators
how do i run a cron job ?
I have a script chaseUp.php and it's on linux.
does anyone know the exact commands I would need to type into the command prompt to make this be run automatically everyday at 6pm ?
Cheers
does anyone know the exact commands I would need to type into the command prompt to make this be run automatically everyday at 6pm ?
Cheers
Code: Select all
crontab -e
0 6 * * * /usr/bin/php your/path/chaseUp.php >/dev/nullCode: Select all
crontab -e
0 6 * * * wget - O - http://www.yoursite/chaseUp.php
Last edited by Kriek on Wed Apr 23, 2003 8:03 pm, edited 2 times in total.
A simple Google search has many answers to questions you might have about cron.
BTW: http://cronjobs.com has a nice service if your host doesn't offer you cron or it is impossible for you to get it.
BTW: http://cronjobs.com has a nice service if your host doesn't offer you cron or it is impossible for you to get it.
Kriek wrote:Code: Select all
crontab -e 0 6 * * * /usr/bin/php your/path/chaseUp.php >/dev/null
Hey Kriek, just wondering what the asterisks are for ....
And what "/usr/bin/php" is for
And the >/dev/null thing too ? .. does that send output to be deleted or something ?
Cheers,
Eli
If your server doesn't support to run a php file directly try this perl script.
And put the perl script in a cronjob.

And put the perl script in a cronjob.
Code: Select all
#!/usr/bin/perl
require "http-lib.pl";
$p = &HTTPGet("/page.php","www.domain.com",80,"?foo=bar");
print $p;Each Cron Job record is composed of six fields: Minute (0-59), Hour (0-23), Day of Month (1-31), Month of Year (1-12), Day of Week (0-6), and the Command. An asterisk can be used as a wildcard to signify all values in a field. For example, by placing an asterisk in the 3rd field, the Cron Daemon will run a job every day. In the sixth field of each entry, long, complex commands can be added.lazy_yogi wrote: what the asterisks are for?
Most PHP installations include CGI/CLI support, so you can execute a PHP script using the Order PHP which is commonly /usr/local/bin/php or /usr/bin/php in UNIX.lazy_yogi wrote:what "/usr/bin/php" is for
Email is Crontab's way of notifying you that it has completed (or not) the job you requested it to run. After everything is running smoothly, you may want to disable this feature, or redirect the output to a log file instead of an email.lazy_yogi wrote:>/dev/null thing too
*/15 * * * * lynx -dump http://www.yourdomain.com/script.php
this will work - this will make the script work every 15 minutes.
this will work - this will make the script work every 15 minutes.
