Comment to 'How to use Cron jobs'
  • Hello saravanan 

    First of all, you need to have your own Cron class which will be the child of the BxDolCron class, and have the processing method. This method is responsible for the execution of your code during the call. Then you add your Cron Jobs object to the `sys_cron_jobs` table like:

    INSERT INTO `sys_cron_jobs` (`name`, `time`, `class`, `file`, `service_call`) VALUES

    ('name of your operation', 'time of your operation in Cron Jobs fromat like */10 * * * *','name of your class', 'name of your class file with the path', 'name of the service method which will be called too');

    You may see the default examples like

    INSERT INTO `sys_cron_jobs` (`name`, `time`, `class`, `file`, `service_call`) VALUES

    ('pruning', '0 0 * * *', 'BxDolCronPruning', 'inc/classes/BxDolCronPruning.php', ''),

    ('sys_acl', '0 0 * * *', 'BxDolCronAcl', 'inc/classes/BxDolCronAcl.php', ''),

    ('sys_account', '0 0 * * *', 'BxDolCronAccount', 'inc/classes/BxDolCronAccount.php', '');

    💓0 😆0 😲0 😥0 😠0 0
    • Sir.., I have attached the screenshot sys_cron_jobs DB Table & Coding file below.Please check & help..


      💓0 😆0 😲0 😥0 😠0 0
      • May you please check does this method run? You may do it with our BxDolLog class. Just add the following code at the body of your processing method:

        $oLog = BxDolLog::getInstance();

        $oLog->setName('test');

        $oLog->write('run!');

        The test.log file should be created in the logs folder.

        💓0 😆0 😲0 😥0 😠0 0
        • I have inserted in that coding.but not reflect anything in test.log file.

          💓0 😆0 😲0 😥0 😠0 0

        UNA - Network Infrastructure for Communities

        Close