opencats / OpenCATS

Applicant Tracking System (maintained code base)
http://www.opencats.org
Other
511 stars 243 forks source link

Event Reminders not working. Help with Cron Job or Windows Scheduler. #549

Closed summit1691 closed 2 years ago

summit1691 commented 3 years ago

Emails are working but when I schedule an event reminder I am not receiving any email reminders. I read about setting up a cron job or scheduler for Windows but coudn't find any information on how to set up using the current build.

RussH commented 3 years ago

Hi,

it's the same instructions as per previous builds, create the same cron job.

summit1691 commented 3 years ago

Hello Rush, thanks for your response but I am not able to find any instructions in installation document. Can you please provide me a link for the instructions to set up a cron job.

RussH commented 3 years ago

Hiya,

sorry - I see the update never made it into the Documentation. I'll have to update that myself.. I think the installation document will just be installation and a user guide going forwards, the additional advanced/config info will live in the wiki

Here you go https://github.com/opencats/gitbook/issues/5

dharias commented 3 years ago

Hi Rush when I run QueueCLI.php it shows the message Deprecated: Non-static method QueueProcessor :: getHour () should not be called statically in /var/www/html/lib/QueueProcessor.php on line 544

Deprecated: Non-static method QueueProcessor :: getMinute () should not be called statically in /var/www/html/lib/QueueProcessor.php on line 548 CATS Queue Processor status: NO TASKS

I am running PHP 7.3 sorry for my English ;)

RussH commented 3 years ago

Hi Diego,

php 7.2 is the maximum PHP level currently supported - our Travis CI tests for PHP 7.3 are failing for the most recent build. I would not deploy on that level.

However - what you see for QueueProcessor.php are deprecation warnings - not errors. Functionality should be unchanged.


Russ

On Mon, 23 Aug 2021 at 15:24, Diego Arias @.***> wrote:

Hi Rush when I run QueueCLI.php it shows the message Deprecated: Non-static method QueueProcessor :: getHour () should not be called statically in /var/www/html/lib/QueueProcessor.php on line 544

Deprecated: Non-static method QueueProcessor :: getMinute () should not be called statically in /var/www/html/lib/QueueProcessor.php on line 548 CATS Queue Processor status: NO TASKS

I am running PHP 7.3 sorry for my English ;)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/opencats/OpenCATS/issues/549#issuecomment-903821938, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACFA7D7L2Y7RMTBY6FVZR3T6JKYNANCNFSM5CQ4WTBQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

summit1691 commented 3 years ago

Hello Russh, I am on Windows so I set up a scheduler to invoke queuecli.php every minute but still it's not working. I tried to manually invoke queuecli.php but I always get the result "CATS Queue Processor status: NO TASKS" Do any changes are required in Module or Lib files as well.

shantadam commented 3 years ago

Hello @summit1691, if I may,

Based on QueueProcessor::startNextTask() your database table "queue" should have some entries. Can you see what the status of your database table "queue" looks like?

summit1691 commented 3 years ago

Hello Shantadam, Database table Queue is empty. I have entered few events and reminders. They are showing up in reminders table but Queue is empty.

shantadam commented 3 years ago

@summit1691,

Can you check if you have any "tasks.php" file under any module folder in "/modules". Kindly, requesting to open your PowerShell command terminal and cd to your {opencatsdir} then run Get-Childitem –Path ".\modules" -Filter "tasks.php" -Recurse. See if anything comes-up.

shantadam commented 3 years ago

@summit1691,

After all, the reason of getting your attention under /modules folder is the expectation that tasks are configured under /modules/queue/tasks.php.

The fact is it's important to understand QueueCLI.php's activities. It starts calling ModuleUtility::registerModuleTasks() which in its turn runs recursively through modules and picks-up "tasks.php" found files to include and make it available for QueueCLI.php to subsequently call for QueueProcessor::startNextTask().

Prior to the latter method (QueueProcessor::startNextTask()) call if you haven't defined your tasks files and registered in tasks.php for your modules it won't find any tasks to run, as described in {opencatsdir}/modules/queue/tasks.php, as such: // Add a new task to the queue processor using the following line as an example. // Use the modules/queue/tasks/SampleRecurring.php file as a template // QueueProcessor::registerRecurringTask('SampleRecurring');

Hope it helps.

summit1691 commented 3 years ago

I have added a task in the module/calendar/tasks: QueueProcessor::registerRecurringTask('./modules/calendar/tasks/Reminders.php'); Reminders.php was already there.

shantadam commented 3 years ago

@summit1691, can you break at QueueProcessor::startTask() and see if that method is being triggered at all?

summit1691 commented 3 years ago

QueueProcessor::startTask() Sorry but I am not sure where that is.

shantadam commented 3 years ago

@summit1691,

If you haven't installed xdebug yet, please follow the simplest no IDE solution "Command Line Debug Client" instructions found at https://xdebug.org/download, and familiarize with the quick basic documentation at https://xdebug.org/docs/dbgpClient.

Once the command line terminal starts set a debugging breakpoint at line 231 or the 1st line inside startTask() found inside {opencatsdir}/lib/QueueProcessor.php, as such: (cmd) breakpoint_set -t line -f file:///{opencatsdir}/lib/QueueProcessor.php -n 231

Reload the app in the browser.

summit1691 commented 3 years ago

Ok, I will do that. But I think the problem I am facing is not tasks are getting entered in Queue. So there are no tasks to be processed in Queue.

summit1691 commented 3 years ago

Hello, I was trying to install xdebug and I found out it does not support PHP 5.6 which was required for installing opencats. So is there any other options.

RussH commented 3 years ago

Hi @summit1691 https://github.com/opencats/opencats/releases - v0.9.6 supports PHP7.2 - which package have you installed if it's not 0.9.6?

summit1691 commented 3 years ago

I have installed v0.9.6 only but I read in the installation document that it was better to run the installation wizard in PHP5.6 I am assuming I should upgrade to PHP7.2 after installation was completed?

summit1691 commented 3 years ago

Hello, I upgraded to PHP7.2 and installed xdebug but after running the breakpoint_set command the webpage did not reload.

dharias commented 3 years ago

hello I have the same problem as summit. I add the reminder in the calendar, I run the scheduled task and it always shows me "CATS Queue Processor status: NO TASKS". and it doesn't add any records in the queue table of my db. sorry for my English

shantadam commented 3 years ago

Thanks @Diego. This issue will have to be investigated in more depth and see the cause. Probably something’s failing in the background silently. I’ll take a peak at it throughout the next day or two, and I’ll get back to you guys. Your patience is certainly appreciated. Thanks.

Cheers, Shant Adam

On Aug 25, 2021, at 6:16 AM, Diego Arias @.***> wrote:



hello I have the same problem as summit. I add the reminder in the calendar, I run the scheduled task and it always shows me "CATS Queue Processor status: NO TASKS". and it doesn't add any records in the queue table of my db. sorry for my English

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/opencats/OpenCATS/issues/549#issuecomment-905492749, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA53AVILSSC7YYFJ3ABEGVTT6TULPANCNFSM5CQ4WTBQ.

summit1691 commented 3 years ago

Hello, I was able to get the email reminders working by:

  1. Mentioning full path for Reminders.php in module/calendar/tasks/Tasks.php
  2. Check if an old instance of this SAME recurring task is running But then once the reminders start they never stop. Still getting "NO TASK" in Queuecli.php
shantadam commented 3 years ago

I get the sense that your last, high level, two sentence explanations are covering underlying details. While keeping it simple, can you please elaborate @summit1691. What steps have you taken, what actions have you taken at each step, and exactly what file and which line you’ve applied changes. Thank you.

Regards,

Shant Adam, T: (778) 877-2028 E: @.**@.>

DISCLAIMER - This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission.

From: summit1691 @.> Date: Thursday, August 26, 2021 at 10:55 AM To: opencats/OpenCATS @.> Cc: Shant Adam @.>, Comment @.> Subject: Re: [opencats/OpenCATS] Event Reminders not working. Help with Cron Job or Windows Scheduler. (#549)

Hello, I was able to get the email reminders working by:

  1. Mentioning full path for Reminders.php in module/calendar/tasks/Tasks.php
  2. Check if an old instance of this SAME recurring task is running But then once the reminders start they never stop. Still getting "NO TASK" in Queuecli.php

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/opencats/OpenCATS/issues/549#issuecomment-906620120, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA53AVP7AUTJMJ4S7GDMAEDT6Z5YTANCNFSM5CQ4WTBQ.

summit1691 commented 3 years ago

I get the sense that your last, high level, two sentence explanations are covering underlying details. While keeping it simple, can you please elaborate @summit1691. What steps have you taken, what actions have you taken at each step, and exactly what file and which line you’ve applied changes. Thank you. Regards, -- Shant Adam, T: (778) 877-2028 E: @.**@.> -- DISCLAIMER - This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. From: summit1691 @.> Date: Thursday, August 26, 2021 at 10:55 AM To: opencats/OpenCATS @.> Cc: Shant Adam @.>, Comment @.> Subject: Re: [opencats/OpenCATS] Event Reminders not working. Help with Cron Job or Windows Scheduler. (#549) Hello, I was able to get the email reminders working by: 1. Mentioning full path for Reminders.php in module/calendar/tasks/Tasks.php 2. Check if an old instance of this SAME recurring task is running But then once the reminders start they never stop. Still getting "NO TASK" in Queuecli.php — You are receiving this because you commented. Reply to this email directly, view it on GitHub<#549 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA53AVP7AUTJMJ4S7GDMAEDT6Z5YTANCNFSM5CQ4WTBQ.

Hello, I am sorry about the confusing high level reply. I am a Recruiter (Not a developer OR even an IT Guy). Having said that I was able to get the email reminders working. I think the issue is in the below code in function registerRecurringTask in \lib\QueueProcessor.php

if (!self::isTaskReady($task->getSchedule())) return;

    // Check if an old instance of this SAME recurring task is running, do not run over the top of it
    $sql = sprintf(
        "SELECT
            COUNT(queue_id)
         FROM
            queue
         WHERE
            task = %s
         AND
            locked = 1",
        $db->makeQueryString($taskName)
    );
    $cnt = $db->getColumn($sql, 0, 0);

    if ($cnt > 0)
    {
        // Instance of this task is running
        return;
    }

Below are the steps I used to make it working.

  1. I am using WIN10 so created a scheduler task to run queuecli.php every minute.
  2. In the file \lib\QueueProcessor.php added the below function: public static function registerTask($taskPath) { $db = DatabaseConnection::getInstance();

    $taskName = self::getTaskNameFromPath($taskPath);
    $task = self::getInstantiatedTask($taskPath);
    
    $taskID = self::addAsynchronousTask(CATS_ADMIN_SITE, $taskName, 0, 5);
    self::startTask(CATS_ADMIN_SITE, $taskPath, 0, 5, $taskID);

    }

  3. In the file \modules\calendar\tasks\tasks.php replaced QueueProcessor::registerRecurringTask('reminders.php'); with QueueProcessor::registerTask(LEGACY_ROOT . '/modules/calendar/tasks/reminders.php');

Now its working completely fine.

(The last issue of non-stop reminders was my mistake I commented a piece of code in reminders.php by mistake)

shantadam commented 3 years ago

Thank you, @summi1691.

I appreciate the honesty and the time taken to take a stab at finding the issue. However, we’ll have to further investigate in-depth. We’ll get back in to you in the next day or two. Thank you.

Regards,

Shant Adam, T: (778) 877-2028 E: @.**@.>

DISCLAIMER - This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission.

From: summit1691 @.> Date: Thursday, August 26, 2021 at 12:53 PM To: opencats/OpenCATS @.> Cc: Shant Adam @.>, Comment @.> Subject: Re: [opencats/OpenCATS] Event Reminders not working. Help with Cron Job or Windows Scheduler. (#549)

I get the sense that your last, high level, two sentence explanations are covering underlying details. While keeping it simple, can you please elaborate @summit1691https://github.com/summit1691. What steps have you taken, what actions have you taken at each step, and exactly what file and which line you’ve applied changes. Thank you. Regards, -- Shant Adam, T: (778) 877-2028 E: @.@.> -- DISCLAIMER - This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. From: summit1691 @.> Date: Thursday, August 26, 2021 at 10:55 AM To: opencats/OpenCATS @.> Cc: Shant Adam @.>, Comment @.> Subject: Re: [opencats/OpenCATS] Event Reminders not working. Help with Cron Job or Windows Scheduler. (#549https://github.com/opencats/OpenCATS/issues/549) Hello, I was able to get the email reminders working by: 1. Mentioning full path for Reminders.php in module/calendar/tasks/Tasks.php 2. Check if an old instance of this SAME recurring task is running But then once the reminders start they never stop. Still getting "NO TASK" in Queuecli.php — You are receiving this because you commented. Reply to this email directly, view it on GitHub<#549 (comment)https://github.com/opencats/OpenCATS/issues/549#issuecomment-906620120>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA53AVP7AUTJMJ4S7GDMAEDT6Z5YTANCNFSM5CQ4WTBQ.

Hello, I am sorry about the confusing high level reply. I am a Recruiter (Not a developer OR even an IT Guy). Having said that I was able to get the email reminders working. I think the issue is in the below code in function registerRecurringTask in \lib\QueueProcessor.php

if (!self::isTaskReady($task->getSchedule())) return;

// Check if an old instance of this SAME recurring task is running, do not run over the top of it

$sql = sprintf(

    "SELECT

        COUNT(queue_id)

     FROM

        queue

     WHERE

        task = %s

     AND

        locked = 1",

    $db->makeQueryString($taskName)

);

$cnt = $db->getColumn($sql, 0, 0);

if ($cnt > 0)

{

    // Instance of this task is running

    return;

}

Below are the steps I used to make it working.

  1. I am using WIN10 so created a scheduler task to run queuecli.php every minute.
  2. In the file \lib\QueueProcessor.php added the below function: public static function registerTask($taskPath) { $db = DatabaseConnection::getInstance();
  1. $taskName = self::getTaskNameFromPath($taskPath);

  2. $task = self::getInstantiatedTask($taskPath);

  3. $taskID = self::addAsynchronousTask(CATS_ADMIN_SITE, $taskName, 0, 5);

  4. self::startTask(CATS_ADMIN_SITE, $taskPath, 0, 5, $taskID);

}

  1. In the file \modules\calendar\tasks\tasks.php replaced QueueProcessor::registerRecurringTask('reminders.php'); with QueueProcessor::registerTask(LEGACY_ROOT . '/modules/calendar/tasks/reminders.php');

Now its working completely fine.

(The last issue of non-stop reminders was my mistake I commented a piece of code in reminders.php by mistake)

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/opencats/OpenCATS/issues/549#issuecomment-906698608, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA53AVMM27PGKVAQKN7SCRDT62LTZANCNFSM5CQ4WTBQ.

dharias commented 3 years ago

@shantadam @summit1691 thanks for your time and patience. It worked for me, I am still testing it in my development environment, I am waiting for the final solution. Thank you very much for the contribution. Sorry for my English

shantadam commented 3 years ago

@Diego,

Would be kind enough to share with us your solution while we work towards a final resolution?

Regards,

Shant Adam, T: (778) 877-2028 E: @.**@.>

DISCLAIMER - This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission.

From: Diego Arias @.> Date: Thursday, August 26, 2021 at 2:32 PM To: opencats/OpenCATS @.> Cc: Shant Adam @.>, Mention @.> Subject: Re: [opencats/OpenCATS] Event Reminders not working. Help with Cron Job or Windows Scheduler. (#549)

@shantadamhttps://github.com/shantadam @summit1691https://github.com/summit1691 thanks for your time and patience. It worked for me, I am still testing it in my development environment, I am waiting for the final solution. Thank you very much for the contribution. Sorry for my English

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/opencats/OpenCATS/issues/549#issuecomment-906757958, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA53AVPMSXI6WK2526NC343T62XHRANCNFSM5CQ4WTBQ.

dharias commented 3 years ago

Hi @shantadam. I applied the changes proposed by @summit1691 and it worked for me.

shantadam commented 3 years ago

I’m glad all worked out for you, @Diego. Enjoy the app.

Regards,

Shant Adam, T: (778) 877-2028 E: @.**@.>

DISCLAIMER - This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission.

From: Diego Arias @.> Date: Friday, August 27, 2021 at 6:22 AM To: opencats/OpenCATS @.> Cc: Shant Adam @.>, Mention @.> Subject: Re: [opencats/OpenCATS] Event Reminders not working. Help with Cron Job or Windows Scheduler. (#549)

Hi @shantadamhttps://github.com/shantadam. I applied the changes proposed by @summit1691https://github.com/summit1691 and it worked for me.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/opencats/OpenCATS/issues/549#issuecomment-907199506, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA53AVJT3IWCCACBBDSY6O3T66GSLANCNFSM5CQ4WTBQ.

ashishnishad commented 1 year ago

I found issue in this file \lib\QueueProcessor.php and in this function public static function registerRecurringTask($taskPath)

in this function, change this if ($cnt > 0) with this if ($cnt[0] > 0) then all will work