Kernel::System::CronEvent

NAME

Kernel::System::CronEvent – Cron Events wrapper functions

DESCRIPTION

Functions to calculate cron events time.

new()

Create a CronEvent object. Do not use it directly, instead use:

    my $CronEventObject = $Kernel::OM->Get('Kernel::System::CronEvent');

NextEventGet()

Returns the datetime string when the next cron event should occur.

    my $EventSystemTime = $CronEventObject->NextEventGet(
        Schedule      => '*/2 * * * *',     # recurrence parameters based in cron notation
        StartDateTime => $DateTimeObject,   # optional, default $DateTimeObject 'now' in system time zone
    );

Returns:

    my $EventDateTime = '2016-01-23 14:56:12';  # or undef in case of an error

PreviousEventGet()

Returns the datetime string when the last Cron event had occurred.

    my $PreviousSystemTime = $CronEventObject->PreviousEventGet(
        Schedule      => '*/2 * * * *',     # recurrence parameters based in Cron notation
        StartDateTime => $DateTimeObject,   # optional, default $DateTimeObject 'now' in system time zone
    );

Returns:

    my $EventDateTime = '2016-03-12 11:23:45';  # or undef in case of an error

GenericAgentSchedule2CronTab()

Converts a GenericAgent schedule to a CRON tab format string.

    my $Schedule = $CronEventObject->GenericAgentSchedule2CronTab(
        ScheduleMinutes [1,2,3],
        ScheduleHours   [1,2,3],
        ScheduleDays    [1,2,3],
    );

    my $Schedule = '1,2,3 1,2,3 * * 1,2,3 *'    # or undef in case of an error
Scroll to Top