commit | 1ea33e0465f631754b85f1e24cc92e7e63bd871f | [log] [tgz] |
---|---|---|
author | Jason Peterson <jasonpet@us.ibm.com> | Thu Feb 23 12:30:20 2017 -0500 |
committer | Jason Peterson <jasonpet@us.ibm.com> | Thu Feb 23 16:30:25 2017 -0500 |
tree | d366e6821adf0b4d33af2d0d07c66f711c416281 | |
parent | 2a34c830d911d7a7201010468a25f9f66dd3d1b6 [diff] |
Add jshint validation to travis and cleanup existing jshint issues
The /whisk.system/alarms
package can be used to fire a trigger at a specified frequency. This is useful for setting up recurring jobs or tasks, such as invoking a system backup action every hour.
The package includes the following feed.
Entity | Type | Parameters | Description |
---|---|---|---|
/whisk.system/alarms | package | - | Alarms and periodic utility |
/whisk.system/alarms/alarm | feed | cron, trigger_payload, maxTriggers | Fire trigger event periodically |
The /whisk.system/alarms/alarm
feed configures the Alarm service to fire a trigger event at a specified frequency. The parameters are as follows:
cron
: A string, based on the UNIX crontab syntax, that indicates when to fire the trigger in Coordinated Universal Time (UTC). The string is a sequence of five fields that are separated by spaces: X X X X X
. For more details about using cron syntax, see: http://crontab.org. Following are some examples of the frequency that is indicated by the string:
* * * * *
: top of every minute.0 * * * *
: top of every hour.0 */2 * * *
: every 2 hours (i.e. 02:00:00, 04:00:00, ...)0 9 8 * *
: at 9:00:00AM (UTC) on the eighth day of every monthtrigger_payload
: The value of this parameter becomes the content of the trigger every time the trigger is fired.
maxTriggers
: Stop firing triggers when this limit is reached. Defaults to 1,000,000. You can set it to infinite (-1).
The following is an example of creating a trigger that will be fired once every 2 minutes with name
and place
values in the trigger event.
$ wsk trigger create periodic --feed /whisk.system/alarms/alarm --param cron "*/2 * * * *" --param trigger_payload "{\"name\":\"Odin\",\"place\":\"Asgard\"}"
Each generated event will include as parameters the properties specified in the trigger_payload
value. In this case, each trigger event will have parameters name=Odin
and place=Asgard
.
Note: The parameter cron
also supports a custom syntax of six fields, where the first field represents seconds. For more details about using this custom cron syntax, see: https://github.com/ncb000gt/node-cron. Here is an example using six fields notation:
*/30 * * * * *
: every thirty seconds.