Constants

WEEKDAY_SUN

WEEKDAY_SUN

Defines the day of the week as Sunday

WEEKDAY_MON

WEEKDAY_MON

Defines the day of the week as Monday

WEEKDAY_TUE

WEEKDAY_TUE

Defines the day of the week as Tuesday

WEEKDAY_WED

WEEKDAY_WED

Defines the day of the week as Wednesday

WEEKDAY_THU

WEEKDAY_THU

Defines the day of the week as Thursday

WEEKDAY_FRI

WEEKDAY_FRI

Defines the day of the week as Friday

WEEKDAY_SAT

WEEKDAY_SAT

Defines the day of the week as Saturday

CONST_YEARLY

CONST_YEARLY

A pre-setting to run the cronjob yearly at 1 Jan, 00:00

CONST_MONTHLY

CONST_MONTHLY

A pre-setting to run the cronjob monthly at 00:00

CONST_WEEKLY

CONST_WEEKLY

A pre-setting to run the cronjob weekly on Sunday, 00:00

CONST_DAILY

CONST_DAILY

A pre-setting to run the cronjob daily at 00:00

CONST_HOURLY

CONST_HOURLY

A pre-setting to run the cronjob hourly at 00 minutes

CONST_REBOOT

CONST_REBOOT

A pre-setting to run the cronjob on server startup

MONTH_JAN

MONTH_JAN

Defines the month as January

MONTH_FEB

MONTH_FEB

Defines the month as February

MONTH_MAR

MONTH_MAR

Defines the month as March

MONTH_APR

MONTH_APR

Defines the month as April

MONTH_MAY

MONTH_MAY

Defines the month as May

MONTH_JUN

MONTH_JUN

Defines the month as June

MONTH_JUL

MONTH_JUL

Defines the month as July

MONTH_AUG

MONTH_AUG

Defines the month as August

MONTH_SEP

MONTH_SEP

Defines the month as September

MONTH_OCT

MONTH_OCT

Defines the month as October

MONTH_NOV

MONTH_NOV

Defines the month as November

MONTH_DEC

MONTH_DEC

Defines the month as December

Properties

$validConstants

$validConstants : array

Array of valid CRON constants

Type

array

$crontab

$crontab : array

The current crontab data

Type

array

Methods

__construct()

__construct() 

Instantiates the crontab handler

reloadCrontab()

reloadCrontab() : \Alo\Cron

(re)loads the cron job array

Returns

\Alo\Cron

editCronJob()

editCronJob(integer  $index, string  $command, integer|string  $minute_const = '*', integer|string  $hour = '*', integer|string  $day = '*', integer|string  $month = '*', integer|string  $weekday = '*') : \Alo\Cron

Edits the cron job at index $index. Can be substituded with the full CRON expression (schedule + command) to perform a search - use with caution!

Parameters

integer $index

The job index in the crontab array

string $command

The command to run

integer|string $minute_const

The minute parameter

integer|string $hour

The hour parameter

integer|string $day

The day of the month parameter

integer|string $month

The month parameter

integer|string $weekday

The day of the week parameter

Returns

\Alo\Cron

appendCrontab()

appendCrontab(string  $command, integer|string  $minute_const = '*', integer|string  $hour = '*', integer|string  $day = '*', integer|string  $month = '*', integer|string  $weekday = '*') : \Alo\Cron

Appends the crontab file

Parameters

string $command

The command to run

integer|string $minute_const

The minute parameter

integer|string $hour

The hour parameter

integer|string $day

The day of the month parameter

integer|string $month

The month parameter

integer|string $weekday

The day of the week parameter

Returns

\Alo\Cron

commit()

commit() : \Alo\Cron

Saves any changes made

Returns

\Alo\Cron

deleteJob()

deleteJob(integer  $index) : \Alo\Cron

Removes the cron job @ index $index

Parameters

integer $index

The cron job's index in the array

Returns

\Alo\Cron

getCrontab()

getCrontab() : array

Returns the crontab array

Returns

array

__toString()

__toString() : string

Returns a string representation of the object data

Returns

string

editCrontab()

editCrontab(integer  $index, string  $command, integer|string  $minute_const = '*', integer|string  $hour = '*', integer|string  $day = '*', integer|string  $month = '*', integer|string  $weekday = '*') : \Alo\Cron

Performs modifiation on the crontab file

Parameters

integer $index

The job index in the crontab array

string $command

The command to run

integer|string $minute_const

The minute parameter

integer|string $hour

The hour parameter

integer|string $day

The day of the month parameter

integer|string $month

The month parameter

integer|string $weekday

The day of the week parameter

Throws

\Alo\Exception\CronException

When the minute expression is invalid

\Alo\Exception\CronException

When the parameters are invalid

\Alo\Exception\CronException

When one or more parameters are non-scalar

Returns

\Alo\Cron

formatOK()

formatOK(integer|string  $min, integer|string  $hour, integer|string  $day, integer|string  $month, integer|string  $weekday) : boolean

Checks whether all the fields are formatted properly

Parameters

integer|string $min

The minute parameter

integer|string $hour

The hour parameter

integer|string $day

The day of the month parameter

integer|string $month

The month parameter

integer|string $weekday

The day of the week parameter

Returns

boolean