Documentation
CRON
usage
<CRON ID="number">
<INFO>
<ID>number</ID>
<ACTIVITY>1</ACTIVITY>
<ISLOCKED>0</ISLOCKED>
<CREATORID>contactID</CREATORID>
<OWNERID>contactID</OWNERID>
<GROUPID>groupID</GROUPID>
<MODIFIERID>contactID</MODIFIERID>
<CREATIONDATE>YYYY-MM-DD hh:mm:ss</CREATIONDATE><!-- automatically filled by Sushee -->
<MODIFICATIONDATE>YYYY-MM-DD hh:mm:ss</MODIFICATIONDATE><!-- automatically filled by Sushee -->
<TYPE>{url,nql,shell,phpclass}</TYPE>
<DOMAIN>text</DOMAIN>
<DENOMINATION>text</DENOMINATION>
<COMMAND>text</COMMAND>
<CLASSFILE>text</CLASSFILE>
<CLASSNAME>text</CLASSNAME>
<METHOD>text</METHOD>
<STATUS>{pending,running,disabled}</STATUS>
<CALLBACK/>
<MINUTE>text</MINUTE>
<HOUR>text</HOUR>
<DAY>text</DAY>
<MONTH>text</MONTH>
<WEEKDAY>text</WEEKDAY>
<NOTES>text</NOTES>
</INFO>
</CRON>
Cron is a module intended for developpers (no user interface is currently provided) to schedule repeated tasks.
Sushee resolve the crons every minute. Each cron can trigger several tasks according its Minute, Hour, Day, Month, and Weekday configuration.
DON'T FORGET TO END YOUR VALUES BY AN ENDING COMMA !
Minute
Comma-saparated list of the minute(s) where the task(s) is(are) triggered. The values have to be encoded with two digits.
- 00,30, : a task will be triggered every 30 minutes
- 00,15,30,45, : a task will be triggered every 15 minutes
- 00 10,20,30,40,50, : a task will be triggered every 10 minutes
- 00, : a task will be triggered at a plain hour
- Leave blank to trigger a task every minute
Hour
Comma-saparated list of the hour(s) where the task(s) is(are) triggered. The values have to be encoded with two digits.
- 00,12, : a task will be triggered at noon and midnight
- 00,04,08,12,16,20, : a task will be triggered every 4 hours
- 18, : a task will be triggered at 6 PM
- Leave blank to trigger a task every hour
Day
Comma-saparated list of the day(s) of the month where the task(s) is(are) triggered. The values have to be encoded with two digits.
- 01, : a task will be triggered at the first day of the month
- 01,15, : a task will be triggered two times per month
- Leave blank to trigger a task every day
Month
Comma-saparated list of the month(s) of the year where the task(s) is(are) triggered. The values have to be encoded with two digits.
- 01, : a task will be triggered in january
- 01,04,07,10, : a task will be triggered every three months
- Leave blank to trigger a task every month
Weekday
Comma-saparated list of the day(s) of the week where the task(s) is(are) triggered. The values have to be encoded with ONE digit.
- 1, : a task will be triggered on monday
- 3,7, : a task will be triggered on wednesday and sunday
- Leave blank to trigger a task every day of the week
DON'T FORGET TO END YOUR VALUES BY AN ENDING COMMA !
Cron resolution
A cron can launch several tasks according to the combinaison of Minute/Hour/Day/Month/Weekday values.
If you leave every values empty, a task will be triggered every minutes (1440 tasks per day, 525600 tasks per year!).
Sunday morning backup at 8 PM:
- Weekday = 7,
- Hour = 20,
- Minute = 00, (note that if you leave Minutes empty, a backup will be triggered every minutes between 8 PM and 9 PM!)
- Leave other values empty
Send morning email at 07:15 AM on working days:
- Hour = 07,
- Minute = 15 (note that if you leave Minutes empty, a backup will be triggered every minutes between 8 PM and 9 PM!)
- Weekday = 1,2,3,4,5,
- Leave other values empty
Automatic Mail Check every 15 minutes on working days:
- Minute = 00,15,30,15,
- Weekday = 1,2,3,4,5,
- Leave other values empty
Cron status: pending, running, disabled.
The default status for a Cron is "pending". When a Cron is triggered, its status switch to "running" until the task is finished. A Cron in status "running" will NOT be executed to avoid overload of simultaneous processes.
Cron types: url, nql, phpclass or shell.
- A cron of type url is an internet adress to be called in orded to execute the scheduled task. If the url is not absolute (does not begin with 'http://'), it will be executed relative to the sushee root directory.
- A cron of type nql is a set of NQL commands to execute on the Officity where the cron was programmed.
- A cron of type shell is a unix shell command to execute.
- A cron of type phpclass will call a specific method of a PHP class/object. CLASSFILE is the path to the file defining the object (e.g. /Public/myobject.class.php ), CLASSNAME is the name of the object and METHOD is the name of the method to call.
Whether the cron is url, nql or shell, the command itself is encoded in the COMMAND field.
Other fields
The DOMAIN, DENOMINATION and NOTES fields are purely indicative fields, they are only there for the developer's purpose, to classify and annotate its crones.
Logs
When a task is triggered, a CRONLOG element is automatically created.
exemples
<CREATE>
<CRON>
<INFO>
<DOMAIN>Agenda</DOMAIN>
<DENOMINATION>Send morning SMS at 07:15 AM on working days</DENOMINATION>
<TYPE>url</TYPE>
<COMMAND>http://presite.silence.com/apps/sms_alert.php</COMMAND>
<MINUTE>15,</MINUTE>
<HOUR>07,</HOUR>
<WEEKDAY>1,2,3,4,5,</WEEKDAY>
</INFO>
</CRON>
</CREATE>