0

I have a script that I want to run everyminute. I understand how to set the timings of it, I've set it as:

*/5 * * * *

My script that I want to execute is at /var/www/html/domain.co.uk/content/inc/download-feed/banter.php

Would I just have my crontab entry as:

*/5 * * * * /var/www/html/domain.co.uk/content/inc/download-feed/banter.php

Or is there something else I need to add to it?

Thanks!

5 Answers 5

4

Your cron won't run every minute (instead it will run every five minutes).

Usually, the system does not know what to do with a .php-file. So you have to use the php-interpreter and the file as argument for it:

*/5 * * * * /usr/local/bin/php -f /var/www/html/footy-feed.co.uk/content/inc/download-feed/banter.php

or if you want to run it every minute:

* * * * * /usr/local/bin/php -f /var/www/html/footy-feed.co.uk/content/inc/download-feed/banter.php

Please note: the path "/usr/local/bin/" can be different on your system.

1
  • Thank you very much! And yeah I realised after I typed /5 after the first 'every' by accident :)
    – Probocop
    Jul 8, 2010 at 15:06
1

You'll need the full command, so you are basically missing the php interpreter in the code code you posted. Replace

/var/www/html/domain.co.uk/content/inc/download-feed/banter.php

with

/usr/local/bin/php -f \
     /var/www/html/domain.co.uk/content/inc/download-feed/banter.php

If your php executable live somewhere else, you'll need to adjust /usr/local/bin/php.

0

It depends whether you have the PHP commandline interpreter installed, and whether the code inside your PHP script will just run by itself.

If it's just a piece of PHP you'd normally run from a web browser, it might not work. What's inside it?

0

If you want to process it with PHP, you better run it with:

*/5 * * * * php /var/www/html/domain.co.uk/content/inc/download-feed/banter.php
0

Check if you have executable rights on the script file. Make sure you don't edit the /etc/crontab, but use crontab -e so the config will be saved.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .