Library: crontab

From Yombo
Jump to: navigation, search
crontab
Commonly Used Yes
Status Active

Summary
Set up recurring events.

Introduction

The library cron tab implements cron-like functionality for the Yombo Gateway. This allows you to easily setup a scheduled task to be performed on a regular basis. The crontab can be accessed with self._CronTab.

See also

Hooks

No hooks registered.

Usage

Common Functions

When a new cron task is created with the {{filebg|new()}} function, it returns an instance of the cron task that can be used to control it. Below are some helpful functions to manage the cron task.

Examples

 1 #  M H D M DOW
 2 #  * * * * *  # call every minute, every hour, every day, every month
 3 self._CronTab.new(self.myFunction)
 4 
 5 # */2 * * * *  # call every other minute)
 6 myArgs=('arg1', 'arg2')
 7 self._CronTab.new(self.myFunction, min=range(0, 59, 2), args=myArgs)  # use range and specify a step
 8 # The range just creates a list of minutes. You can also just pass a list of numbers.
 9 
10 # 0 0,6,12,18 * * *  # at midnight, 6am, 12pm, 6pm
11 # myKwargs={"argument1" : "value1", "argument2" : "value2"}
12 self._CronTab.new(self.myFunction, min=0, hour=(0,6,12,18), kwargs=myKwargs)  # Notice the list of hours to run.
13 
14 # 0 12 * 0 0 # at 12:00pm on sunday
15 self._CronTab.new(self.myFunction, min=0, hour=12, dow=0 )  # use range and specify a step
16 
17 # 0 12 * 0 0 # at 12:00pm on sunday
18 self._CronTab.new(self.myFunction, min=0, hour=12, dow=0 )  # use range and specify a step


This page was last edited on 10 December 2017.