Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question

migrated from stackoverflow.com Jul 21 '11 at 13:28

This question came from our site for professional and enthusiast programmers.

    
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 '11 at 13:55

2 Answers 2

up vote 5 down vote accepted

*/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)

share|improve this answer
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 '11 at 8:49
    
Thank you so much (: –  Philipp Spieß Jul 21 '11 at 8:51
    
@pwaring, thanks, i'm not very familiar to debian, so don't remember it's path –  k102 Jul 21 '11 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 '11 at 8:56
* * * * * 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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.