Jeedom Core

cron
in package

Table of Contents

Properties

$_changed  : bool
$class  : string
$deamon  : int
$deamonSleepTime  : int
$enable  : int
$function  : string
$id  : int
$once  : int
$option  : string|null
$schedule  : string
$timeout  : int

Methods

all()  : array<string|int, mixed>
Return an array of all cron object
byClassAndFunction()  : object
Return cron object corresponding to parameters
byId()  : object
Get cron object associate to id
clean()  : void
Removes invalid cron schedules
convertDateToCron()  : string
Converts timestamp to cron expression
getCache()  : mixed
getChanged()  : bool
getClass()  : string
getDeamon()  : int
getDeamonSleepTime()  : int
getEnable()  : int
getFunction()  : string
getId()  : int
getLastRun()  : string
getName()  : string
Get human name of cron
getNextRunDate()  : false|string
Calculates next execution time
getOnce()  : int
getOption()  : mixed
getPID()  : int
getPidFile()  : int
Return the current pid of jeecron or empty if not running
getSchedule()  : string
getState()  : string
getTimeout()  : int
halt()  : bool
Forces immediate task termination
isDue()  : bool
Check if it's time to launch cron
jeeCronRun()  : bool
Return state of jeecron master
loadAvg()  : array<string|int, mixed>
Return array of load average
nbCronRun()  : int
Return number of cron running
nbProcess()  : int
Return number of process on system
postInsert()  : void
Initializes a new cron task
preSave()  : mixed
Check if cron object is valid before save
refresh()  : bool
Refresh DB state of this cron
remove()  : bool
Remove cron object
run()  : mixed
Launch cron (this method must be only call by jeecron master)
running()  : bool
Check if this cron is currently running
save()  : bool
Save cron object
searchClassAndFunction()  : array<string|int, cron>
setCache()  : void
setChanged()  : static
setClass()  : static
setDeamon()  : static
setDeamonSleepTime()  : static
setEnable()  : static
setFunction()  : static
setId()  : static
setLastRun()  : void
setOnce()  : static
setOption()  : static
setPID()  : void
setPidFile()  : mixed
Set jeecron pid of current process
setSchedule()  : static
setState()  : void
setTimeout()  : static
start()  : mixed
Set cron to be start
stop()  : void
Signals task to stop
toArray()  : array<string, mixed>
Converts task to array format

Properties

$_changed

private bool $_changed = \false

Change tracking flag

$class

private string $class = ''

Class name for class methods

$deamon

private int $deamon = 0

Daemon mode status

$deamonSleepTime

private int $deamonSleepTime

Sleep time between daemon execution cycles

$enable

private int $enable = 1

Task enabled status

$function

private string $function

Method to execute

$once

private int $once = 0

Single execution flag

$option

private string|null $option

JSON encoded options

$schedule

private string $schedule = ''

Cron schedule expression

$timeout

private int $timeout

Maximum execution time in seconds

Methods

all()

Return an array of all cron object

public static all([mixed $_order = false ]) : array<string|int, mixed>
Parameters
$_order : mixed = false
Return values
array<string|int, mixed>

byClassAndFunction()

Return cron object corresponding to parameters

public static byClassAndFunction(string $_class, string $_function[, string $_option = '' ]) : object
Parameters
$_class : string
$_function : string
$_option : string = ''
Return values
object

byId()

Get cron object associate to id

public static byId(int $_id) : object
Parameters
$_id : int
Return values
object

clean()

Removes invalid cron schedules

public static clean() : void

convertDateToCron()

Converts timestamp to cron expression

public static convertDateToCron(int $_date) : string
Parameters
$_date : int

Timestamp

Return values
string

Cron expression

getCache()

public getCache([string $_key = '' ][, mixed $_default = '' ]) : mixed
Parameters
$_key : string = ''

Cache key

$_default : mixed = ''

Default value

getChanged()

public getChanged() : bool
Return values
bool

getClass()

public getClass() : string
Return values
string

getDeamon()

public getDeamon() : int
Return values
int

getDeamonSleepTime()

public getDeamonSleepTime() : int
Return values
int

getEnable()

public getEnable([int $_default = 0 ]) : int
Parameters
$_default : int = 0

Default value

Return values
int

getFunction()

public getFunction() : string
Return values
string

getLastRun()

public getLastRun() : string
Return values
string

getName()

Get human name of cron

public getName() : string
Return values
string

getNextRunDate()

Calculates next execution time

public getNextRunDate() : false|string
Return values
false|string

Next execution date or false on error

getOnce()

public getOnce([int $_default = 0 ]) : int
Parameters
$_default : int = 0

Default value

Return values
int

getPID()

public getPID([int|null $_default = null ]) : int
Parameters
$_default : int|null = null

Default value

Return values
int

getPidFile()

Return the current pid of jeecron or empty if not running

public static getPidFile() : int
Return values
int

getSchedule()

public getSchedule() : string
Return values
string

getState()

public getState() : string
Return values
string

getTimeout()

public getTimeout() : int
Return values
int

halt()

Forces immediate task termination

public halt() : bool
Tags
throws
Exception

On termination failure

Return values
bool

Success status

isDue()

Check if it's time to launch cron

public isDue([mixed $_datetime = null ]) : bool
Parameters
$_datetime : mixed = null
Return values
bool

jeeCronRun()

Return state of jeecron master

public static jeeCronRun() : bool
Return values
bool

loadAvg()

Return array of load average

public static loadAvg() : array<string|int, mixed>
Return values
array<string|int, mixed>

nbCronRun()

Return number of cron running

public static nbCronRun() : int
Return values
int

nbProcess()

Return number of process on system

public static nbProcess() : int
Return values
int

postInsert()

Initializes a new cron task

public postInsert() : void

preSave()

Check if cron object is valid before save

public preSave() : mixed
Tags
throws
Exception

refresh()

Refresh DB state of this cron

public refresh() : bool
Return values
bool

remove()

Remove cron object

public remove([mixed $halt_before = true ]) : bool
Parameters
$halt_before : mixed = true
Return values
bool

run()

Launch cron (this method must be only call by jeecron master)

public run([mixed $_noErrorReport = false ]) : mixed
Parameters
$_noErrorReport : mixed = false
Tags
throws
Exception

running()

Check if this cron is currently running

public running() : bool
Return values
bool

save()

Save cron object

public save() : bool
Return values
bool

searchClassAndFunction()

public static searchClassAndFunction(string $_class, string $_function[, string|array<string|int, mixed> $_option = '' ]) : array<string|int, cron>
Parameters
$_class : string
$_function : string
$_option : string|array<string|int, mixed> = ''
Return values
array<string|int, cron>

setCache()

public setCache(string $_key[, mixed|null $_value = null ]) : void
Parameters
$_key : string

Cache key

$_value : mixed|null = null

Value to store

setChanged()

public setChanged(bool $_changed) : static
Parameters
$_changed : bool
Return values
static

setClass()

public setClass(string $_class) : static
Parameters
$_class : string
Return values
static

setDeamon()

public setDeamon(int $_deamons) : static
Parameters
$_deamons : int
Return values
static

setDeamonSleepTime()

public setDeamonSleepTime(int $_deamonSleepTime) : static
Parameters
$_deamonSleepTime : int
Return values
static

setEnable()

public setEnable(int $_enable) : static
Parameters
$_enable : int
Return values
static

setFunction()

public setFunction(string $_function) : static
Parameters
$_function : string
Return values
static

setId()

public setId(int $_id) : static
Parameters
$_id : int
Return values
static

setLastRun()

public setLastRun(string $lastRun) : void
Parameters
$lastRun : string

setOnce()

public setOnce(int $_once) : static
Parameters
$_once : int
Return values
static

setOption()

public setOption(mixed $_option) : static
Parameters
$_option : mixed
Return values
static

setPID()

public setPID([int $pid = null ]) : void
Parameters
$pid : int = null

setPidFile()

Set jeecron pid of current process

public static setPidFile() : mixed

setSchedule()

public setSchedule(string $_schedule) : static
Parameters
$_schedule : string
Return values
static

setState()

public setState(string $state) : void
Parameters
$state : string

One of 'stop', 'starting', 'run', 'stoping', 'error', 'Not found'

setTimeout()

public setTimeout(int $_timeout) : static
Parameters
$_timeout : int
Return values
static

start()

Set cron to be start

public start() : mixed

stop()

Signals task to stop

public stop() : void

toArray()

Converts task to array format

public toArray() : array<string, mixed>
Return values
array<string, mixed>

Task properties


        
On this page

Search results