Frequently Asked Questions v2
|FAQ Main / Answer Detail|
Author: Jakub, Honza firstname.lastname@example.org
The script cron.php3 - similar to Unix cron - is able to run PHP scripts on given time. If you want to send e-mail notifications if some condition is satisfied or if you want to exchange items between slices regularly, you will find it useful.
The reason for this script to exist is that it's not easy to run PHP scripts by the Unix cron. It also allows us to use admin interface (AA -> Misc - Cron) to add/modify new tasks to run.
If you want to run some task on given time (like running admin/xmlclient.php3
for Cross Server Item Exchange each 15 minutes), you have to do two steps:
The task you can set/edit on cron admin page (AA -> Misc - Cron). The fields (their names are taken from PHP getdate()) have the following meaning: Let's call time units all from: minutes, hours, mday (month day, 1-31), month, wday (week day, 0-7, where 7 and 0 both mean Sunday). You may use three-letter month and week day names (like "jan","feb","sun","mon"). A time unit may be set to:
|*||not set - jump over this field|
|10||number: run only when time unit equals|
|1-5||range: run when time unit equals 1 or 2 or 3 or 4 or 5|
|0-59/15||range with step: run when time unit (minutes in this case) equals 0 or 15 or 45|
|5,15-25/5,40||you may combine numbers, ranges and ranges with steps, separated by comma|
The task table is allready prefilled on APC ActionApps setup, so you should see something like:
time script params * 1 * * * misc/alerts/alerts.php3 howoften=daily&lang=en (Alerts - daily diggest) * 1 * * 1 misc/alerts/alerts.php3 howoften=weekly&lang=en (Alerts - weekly diggest) * 1 1 * * misc/alerts/alerts.php3 howoften=monthly&lang=en (Alerts - monthly diggest) * 1 * * * misc/alerts/admin_mails.php3 (Alerts - sending of subscription e-mails,...) * 8,23,38,53 * * * admin/xmlclient.php3 (CSN - Item Exchange)(it is just an example - the set of task could be changed in next release of ActionApps)
This must be done by a system administrator (i.e. someone with root shell access), but only has to be done once no matter how many task are sheduled then.
In order we can shedule tasks from ActionApps we must run periodicaly the script cron.php3 (based in root apc-aa install directory). It is not so easy to start php scripts directly from unix cron, that's why you should use aa-http-request shell script (based in misc/ directory), which will start cron.php3 script for you.
The instructions for setup of the aa-http-request script is also inside the script. For setup
follow the nex few steps:
Last Edit: Aug 17 2011
<aafaq id=1726> ~ToDo: 1726 Cron - how to automatically run tasks on given time? </aafaq>
This FAQ interface was developed by Jason at Commons.ca
ActionApps is a free software content management system initiated by
the Association for Progressive Communications (APC)
APC - Internet and ICTs for social justice and development