Page 1 of 1

Crontab

Posted: Mon May 04, 2009 4:43 pm
by MbahGondrong
I used Crontab to execute my php file daily, I have some problem that the crontab does not do. In the php file there is many category and in browser if I choose example localhost/web/file.php?category=type1 the process is done correctly. But in the crontab, the file is processed but the category is not. Anybody have similar experience? or is it just not possible??

Thanks.

Re: Crontab

Posted: Tue May 05, 2009 6:45 am
by Raimo Roopertti
Hi,

The crontab functionality is of course heavily inspired by UNIX' crontab. This means that you can schedule jobs with it. You specify when it must run by a string like: "*/3 5-23 * * *" which means every three minutes, but not during the night, or "0 7 * * *" which means every day at 7 am. You specify what must be run by the class-name of a class implementing 'Runnable', or optionally, implementing the specialized interface CronJob. The CronJob interface extends Runnable but also alows for code to be run when the con-daemon stops or when it starts (a String can be provided for configuration). You must implement such a class and put the class-file e.g. in WEB-INF/classes.
In combination with the 'ClassSecurity' feature you can easily implement CronJobs using the bridge interfaces, so you might want to privilege your class in <mmbase-config>security/classauthentication.xml.