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, static>
Retrieves all cron tasks
byClassAndFunction()  : static|null
Finds a cron task by class and function
byId()  : static|null
Finds a cron task by its 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
Generates readable task name
getNextRunDate()  : false|string
Calculates next execution time
getOnce()  : int
getOption()  : mixed
getPID()  : int
getPidFile()  : string|false
Retrieves stored process ID
getSchedule()  : string
getState()  : string
getTimeout()  : int
halt()  : bool
Forces immediate task termination
isDue()  : bool
Checks if task should be executed
jeeCronRun()  : false|int
Checks if cron master process is running
loadAvg()  : array<int, float>|false
Gets system load averages
nbCronRun()  : int
Counts running cron processes
nbProcess()  : int
Counts system processes
postInsert()  : void
Initializes a new cron task
preSave()  : void
Validates cron task before saving
refresh()  : bool
Updates task state
remove()  : bool
Deletes current cron task
run()  : void
Executes the task (this method must be only call by jeecron master)
running()  : bool
Checks if task is currently running
save()  : bool
Saves current cron task
searchClassAndFunction()  : array<string|int, static>
Searches cron tasks by class and function with pattern matching
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()  : void
Stores current process ID
setSchedule()  : static
setState()  : void
setTimeout()  : static
start()  : void
Marks task for execution
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()

Retrieves all cron tasks

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

Order by daemon status

Return values
array<string|int, static>

byClassAndFunction()

Finds a cron task by class and function

public static byClassAndFunction(string $_class, string $_function[, string $_option = '' ]) : static|null
Parameters
$_class : string

Class name

$_function : string

Method name

$_option : string = ''

JSON encoded options

Return values
static|null

byId()

Finds a cron task by its ID

public static byId(int $_id) : static|null
Parameters
$_id : int

Task identifier

Return values
static|null

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()

Generates readable task name

public getName() : string
Return values
string

Task name

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()

Retrieves stored process ID

public static getPidFile() : string|false
Return values
string|false

Process ID or empty string if not running

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()

Checks if task should be executed

public isDue([string|null $_datetime = null ]) : bool
Parameters
$_datetime : string|null = null

Optional check time

Return values
bool

Execution status

jeeCronRun()

Checks if cron master process is running

public static jeeCronRun() : false|int
Return values
false|int

Session ID or false if not running

loadAvg()

Gets system load averages

public static loadAvg() : array<int, float>|false
Return values
array<int, float>|false

Load averages for 1, 5 and 15 minutes

nbCronRun()

Counts running cron processes

public static nbCronRun() : int
Return values
int

Number of active cron processes

nbProcess()

Counts system processes

public static nbProcess() : int
Return values
int

Total number of processes

postInsert()

Initializes a new cron task

public postInsert() : void

preSave()

Validates cron task before saving

public preSave() : void
Tags
throws
Exception

On validation failure

refresh()

Updates task state

public refresh() : bool
Return values
bool

Success status

remove()

Deletes current cron task

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

Stop task before removal

Return values
bool

Success status

run()

Executes the task (this method must be only call by jeecron master)

public run([bool $_noErrorReport = false ]) : void
Parameters
$_noErrorReport : bool = false

Suppress error reporting

Tags
throws
Exception

On execution failure

running()

Checks if task is currently running

public running() : bool
Return values
bool

Running status

save()

Saves current cron task

public save() : bool
Return values
bool

Success status

searchClassAndFunction()

Searches cron tasks by class and function with pattern matching

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

Class name

$_function : string

Method name

$_option : string|array<string, mixed> = ''

Options to match

Return values
array<string|int, static>

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()

Stores current process ID

public static setPidFile() : void

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()

Marks task for execution

public start() : void

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