2

How to make a minutely cronjob on debian?

Can someone help me?

The "action" should be "php /var/www/cronjob/index.php"

i have no idea!

1
  • Cron works well down to one minute resolutions, but it fuzzes a bit around that mark. If it's important that it runs at the top of the minute very precisely, you may need to daemonize the PHP app in question.
    – Jodie C
    Jul 21, 2011 at 13:55

2 Answers 2

6

*/N * * * * /path_to_php/php /var/www/cronjob/index.php

N - number of minutes. and you may need to specify full path to php (/usr/local/bin/php or whatewer)

3
  • 1
    In my experience you always need to specify the full path, especially if you're running as a user such as www-data. The path to PHP is /usr/bin/php by default on Debian.
    – pwaring
    Jul 21, 2011 at 8:49
  • @pwaring, thanks, i'm not very familiar to debian, so don't remember it's path
    – k102
    Jul 21, 2011 at 8:53
  • To make dealing with cronjob configuration easier, create a command on the shell which executes your PHP. This allows to change the details over time w/o changing the crontab, like a changed path to PHP or if you'd like to modify the php configuration of that task in specific. It will make the crontab easier to read as well.
    – hakre
    Jul 21, 2011 at 8:56
6
* * * * * php /var/www/cronjob/index.php

1: * = every minute

2: * = every hour

3: * = every day of month

4: * = every month

5: * = every day of week

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.