crontab won't work on mac 10.6.7
i create a simple cron job by editing /etc/crontab as following:
*/2 * * * * * php /Users/min/Documents/testcron.php
and the testcron.php is simple as:
<?php
$f开发者_开发知识库d = fopen("/Users/min/Documents/testcron.txt", 'a');
fwrite($fd, "test--cron--\n");
fclose($fd);
?>
then simply save the crontab file and hope magic happen, but nothing happened. i even run the command manually and it worked.
php /Users/min/Documents/testcron.php
anyone have any idea? Thanks
Just a quick note, on some systems you have to do sudo crontab -e , and sudo crontab -l because otherwise you won't have the proper permissions to create or view crontabs
Not certain, but I bet your file is not being read. Perhaps you have to do
$ crontab -e
to edit, and then it gets read properly after you save?
You could probably test this theory by doing
$ crontab -l
to list the table to see if it is working already.
I think there's one column too much. You have 6 time specification columns - it should be 5: minute, hour, day of month, month, day of week:
*/2 * * * * php /Users/min/Documents/testcron.php
精彩评论