
#########
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:


.. code-block:: perl

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



NextEventGet()
==============


gets the time when the next cron event should occur, from a given time.


.. code-block:: perl

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


Returns:


.. code-block:: perl

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



NextEventList()
===============


gets the time when the next cron events should occur, from a given time on a defined range.


.. code-block:: perl

     my @NextEvents = $CronEventObject->NextEventList(
         Schedule      => '*/2 * * * *',         # recurrence parameters based in cron notation
         StartDateTime => $StartDateTimeObject,  # optional, defaults to current date/time
         StopDateTime  => $StopDateTimeObject,
     );


Returns:


.. code-block:: perl

     my @NextEvents = [ '2016-01-12 13:23:01', ...  ];  # or false in case of an error



PreviousEventGet()
==================


gets the time when the last Cron event had occurred, from a given time.


.. code-block:: perl

     my $PreviousSystemTime = $CronEventObject->PreviousEventGet(
         Schedule      => '*/2 * * * *',    # recurrence parameters based in Cron notation
         StartDateTime => $DateTimeObject,  # optional, defaults to current date/time
     );


Returns:


.. code-block:: perl

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



GenericAgentSchedule2CronTab()
==============================


converts a GenericAgent schedule to a CRON tab format string


.. code-block:: perl

     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 false in case of an error



_Init()
=======


creates a Schedule::Cron::Events object.


.. code-block:: perl

     my $CronObject = $CronEventObject->_Init(
         Schedule      => '*/2 * * * *',   # recurrence parameters based in Cron notation
         StartDateTime => $DateTimeObject,
     }





