Problem setting up a cron

Hi,
I can’t set a CRON Job, here is an example of a cron file:

cat /var/spool/cron/zebizcom

# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/CRONN1RXiN installed on Thu Mar  3 00:17:46 2005)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
PATH=/home/zebizcom/zebiz.com/html/
* * * * * t/test.php

You can see that I modified the default path because i tried with the default one and it never worked (it’s still not working) !
the file i want to run is located here:
*ttp://www.zebiz.com/t/test.php

It’s a simple script that put the time it was executed in a txt file
When i run it, it works fine, but not with the CRON :frowning:

Anyone can help me ?
thank you

Please if you post some reply, give me the exact commands i have to run as i’m a linux beginner :slight_smile:
thanks !

You’ll want to change t/test.php to:

/usr/bin/php -q /home/zebizcom/zebiz.com/html/t/test.php

What you have may work if the test.php script is chmod’d 755 (or other executable variations) and the 1st line of the script is:

#!/usr/bin/php -q

But I’d lean toward my suggestion as you can’t go wrong.

Chris

Don’t forget that PHP likes to spit out headers and such, and a lot of scripts don’t deal with this for you. If you wind up getting e-mails every 1 minute, append &>/dev/null to the end of the line. Its also fun logging in and seeing 6,000 empty files left behind by wget…

Oh yes thank you very much :slight_smile:
that’s working fine now :smiley: :smiley:

And do you know how i can run a cronjob every 5 seconds or something like that (in seconds) ?

and also, as i’m new to CRON, how to set a cron job to run:
Every day at 11AM, every minute (or every 5 seconds if possible), during 1 hour? (after one hour it’ll stop)
Is this possible ?

thank you :slight_smile:

You can’t schedule anything more often than once per minute.

The order for schedules is minute, hour, day of month, month, day of week, command so:

Daily at 11: 0 11 * * * command
Every minute during the 11th hour: * 11 * * * command

Of course, if its important something gets executed you’ll need to look into /etc/cron.{daily, weekly, hourly, monthly} or use something like this: http://blog.christopheringram.com/article/8/topic/3 (it does the same thing, only differently.)

Oh Thanks, acron looks great but a bit complicated for me :wink:

Oh yes thank you for the command… But, to really understand:
How would you set up a cron job that must be executed every minute, every day between 10h and 12h ?

Is that possible ? (i don’t need it, it’s just to know)

cheers :slight_smile:

* 10-12 * * * command

or

* 10,11,12 * * * command

Oh ok,
it’s really simple :slight_smile:

thank you very much for your help !