Page 1 of 1
how do i run a cron job ?
Posted: Wed Apr 23, 2003 7:29 pm
by lazy_yogi
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
Posted: Wed Apr 23, 2003 7:56 pm
by Kriek
Code: Select all
crontab -e
0 6 * * * /usr/bin/php your/path/chaseUp.php >/dev/null
Depending on your application, you might prefer to use wget
Code: Select all
crontab -e
0 6 * * * wget - O - http://www.yoursite/chaseUp.php
Posted: Wed Apr 23, 2003 7:59 pm
by m3mn0n
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.

Posted: Wed Apr 23, 2003 11:05 pm
by phice
Oromian: Care to give me $10?

Posted: Wed Apr 23, 2003 11:18 pm
by lazy_yogi
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
Posted: Wed Apr 23, 2003 11:21 pm
by m3mn0n
phice wrote:Oromian: Care to give me $10?

lol... sure if you don't mind the 1000% interest.

Posted: Wed Apr 23, 2003 11:27 pm
by phice
Oromian wrote:phice wrote:Oromian: Care to give me $10?

lol... sure if you don't mind the 1000% interest.

I knew there would be some circumstance... >_<
Posted: Thu Apr 24, 2003 7:01 am
by []InTeR[]
If your server doesn't support to run a php file directly try this perl script.
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;

Posted: Thu Apr 24, 2003 9:39 am
by Kriek
lazy_yogi wrote: what the asterisks are for?
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 "/usr/bin/php" is 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:>/dev/null thing too
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.
Posted: Thu Apr 24, 2003 1:17 pm
by leebo
*/15 * * * * lynx -dump
http://www.yourdomain.com/script.php
this will work - this will make the script work every 15 minutes.
Posted: Thu Apr 24, 2003 2:40 pm
by nigma
Isn't it nice that you can get one task done in so many ways if you are using linux?
Posted: Thu Apr 24, 2003 7:14 pm
by m3mn0n
phice wrote:Oromian wrote:phice wrote:Oromian: Care to give me $10?

lol... sure if you don't mind the 1000% interest.

I knew there would be some circumstance... >_<
as always. heh ^_^