Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
#823503
Hi support,
i have some doubts while executed my code. I need clear idea. https://wiki.processmaker.com/3.1/Execu ... g_cron.php
Code: Select all
C:\Bitnami\processmaker-3.2-0\php>php.exe -f C:\Bitnami\processmaker-3.2-0\apps\processmaker\htdocs\workflow\engine\bin\cron.php
Processing workspace: workflow
* Resending emails............................................[DONE]
* Unpausing applications......................................[DONE]
* Calculating Duration........................................[DONE]
* Executing events............................................[PROCESSING]
* |- End Execution events.....................................[Processed 0]
* Executing the scheduled starting cases......................[PROCESSING]
[DONE]
* Update case labels..........................................[DONE]
* Unassigned case.............................................[DONE]
* Executing cron files in bin/plugins directory in Workspace: workflow* Executing registered cron files for Workspace: workflow.....C:\Bitnami\processmaker-3.2-0\apps\processmaker\htdocs\workflow\engine\plugins\lmsReports\bin\testReport.phpFinished 1 workspaces processed
Done!
#823516
Yes, I executed the cron.php correctly.
My Question:
1. This cron.php will execute our custom cronjob page?
2. If I want to execute custom cron jobs, how I need to proceed?
3. Let's say I have the page of custom cron job in ->Plugins->customcron.php like this. In those case how can I execute? will the processmaker takes the page automatically. Or should i need to do something?
4. I have a page in this structure C:\Bitnami\processmaker-3.2-0\apps\processmaker\htdocs\workflow\engine\plugins\sample\mydata\utils\customconfig.php. But I'm not able to get the current workspace name. I have tried SYS_SYS. But I got an error called unassumed SYS_SYS.
5. Then after some time, I tried to use Creating a cron Using ProcessMaker Classes (https://wiki.processmaker.com/3.0/Plugi ... er_classes)

But I got the following Error!
Code: Select all
 
Executing cron files in bin/plugins directory in Workspace: workflowPHP Parse error:  syntax error, unexpected 'ÔÇé' (T_STRING) in C:\Bitnami\processmaker-3.2-0\apps\processmaker\htdocs\workflow\engine\bin\plugins\Plugin_File_Name.php on line 15
6. Am I missing anything here? Could you help me to do further?
Last edited by jemiris on Wed Jan 22, 2020 3:45 am, edited 1 time in total.
#823541
Here I didn't make any changes in the Plugin_File_Name.php file. To test i just copied from wiki process maker and tested it(https://wiki.processmaker.com/3.0/Plugi ... er_classes). I got the error in the set_include_path(get_include_path() . PATH_SEPARATOR . PATH_DATA_SITE); line when debug and seen
Code: Select all
<?php
class SampleClassCron   
{
   /**
   * Default Constructor for the class
   */
  function __construct (  ) {
 
  }
 
  function executeCron(){    
    if (!defined('PATH_WORKSPACE')) {
       define('PATH_WORKSPACE', PATH_DATA_SITE);
       set_include_path(get_include_path() . PATH_SEPARATOR . PATH_DATA_SITE);
     }
    if(SYS_SYS == "workflow") {   //execute the cron depending on the workspaces defined
      $pluginFile = "";
      if (!class_exists('classPlugin_File_Name')) { 
        $pluginFile = PATH_PLUGINS.'myproject'.PATH_SEP.'services'.PATH_SEP.'class.Plugin_File_Name.php';
      }
      if(file_exists($pluginFile)){
        G::LoadClass('plugin');
        require_once($pluginFile);
        // the automated task is check and recreate the dimension tables
        $plugin = new myClass(); //define the class with the name of the file where the actions will be executed by the cron
        $plugin->followUpActions();
      }
    }    
 
  }
}
Last edited by jemiris on Wed Jan 22, 2020 3:46 am, edited 1 time in total.
#823561
It still isn't working? Did you follow all the steps to create the plugin listed in Plugin Development?

In my opinion, you don't need to create a plugin. You can create an endlessly looping process to execute a script task which has the code that you want to execute:
endlessLoopingProcess.png
endlessLoopingProcess.png (13.24 KiB) Viewed 5994 times
Add a trigger to the script task to be executed.

Set your intermediate timer event to the amount of time when you want the trigger to be executed.

Start a case in the looping process, and let the case run forever.

Set up your ProcessMaker server to periodically execute the timereventcron.php file so that that the script task will periodically execute.

The other way to do this is to create a PHP script file that calls the executeTrigger() web service or REST cases/{app_uid}/execute-trigger and execute that PHP script file as a cron job.
#823566
amosbatto wrote: Tue Mar 26, 2019 10:42 pm It still isn't working? Did you follow all the steps to create the plugin listed in Plugin Development?

In my opinion, you don't need to create a plugin. You can create an endlessly looping process to execute a script task which has the code that you want to execute:
endlessLoopingProcess.png

Add a trigger to the script task to be executed.

Set your intermediate timer event to the amount of time when you want the trigger to be executed.

Start a case in the looping process, and let the case run forever.

Set up your ProcessMaker server to periodically execute the timereventcron.php file so that that the script task will periodically execute.

The other way to do this is to create a PHP script file that calls the executeTrigger() web service or REST cases/{app_uid}/execute-trigger and execute that PHP script file as a cron job.
Yes. I'm getting an error?
Last edited by jemiris on Wed Jan 22, 2020 3:47 am, edited 2 times in total.
#823568
amosbatto wrote: Tue Mar 26, 2019 10:42 pm In my opinion, you don't need to create a plugin. You can create an endlessly looping process to execute a script task
Yes, great idea . Thanks for the Idea. As you say I have done the same below image
endlessLoopingProcess.png
endlessLoopingProcess.png (13.24 KiB) Viewed 5988 times
following this wiki processmaker https://wiki.processmaker.com/3.0/Event ... TimerEvent. Here I have a question?
My Question:
1. is it necessary to execute the timereventcron.php script?
2. If It's necessary to execute the timereventcron.php script. Then This timereventcron.php file has to be created as cron job right ?
3. Yeah i have created the SCHTASKS in Windows as followed in wiki (https://wiki.processmaker.com/3.2/Execu ... in_Windows).
4. I created like below
Code: Select all
SCHTASKS /Create /SC MINUTE /MO 5 /TN "ProcessMaker Timer Event every 5 minutes" /TR "C:\Bitnami\processmaker-3.2-0\php\php.exe -f C:\Bitnami\processmaker-3.2-0\apps\processmaker\workflow\engine\bin\timereventcron.php"
. And it executed correctly every 5mintues correctly but my script tasks did not run. * I had the script to send mail for every 5mins as below.
Code: Select all
$aFields = array('reqUserName' => @=reqUserName, 'reqSup' => @=reqSup,
   'fromReq' => @=fromReq, 'toReq' => @=toReq, 'daysReq' => @=daysReq);
$usr = userInfo(@@USER_LOGGED);
$to = 'jemiris@gmail.com';
PMFSendMessage(@@APPLICATION, 'manager@acme.com', $to, '', '',
   'Leave Request Notification', 'LeaveRequestTemplate.html', $aFields);
** Note : When I execute manually it works via command line. but as cron job it not working. I'm I missing here?
Last edited by jemiris on Wed Jan 22, 2020 3:49 am, edited 1 time in total.
#823581
jemiris wrote:1. is it necessary to execute the timereventcron.php script?
Yes, it is necessary if you are going to use an intermediate timer event in your processes. Otherwise, the case will never move past the intermediate timer event.
jemiris wrote:2. If It's necessary to execute the timereventcron.php script. Then This timereventcron.php file has to be created as cron job right :?:
Yes, you need a cron job in Linux or a Scheduled Task in Windows that will periodically execute the timereventcron.php file on your ProcessMaker server. [/quote]
jemiris wrote:3. Yeah i have created the SCHTASKS in Windows as followed in wiki (https://wiki.processmaker.com/3.2/Execu ... in_Windows).
4. I created like below
I tried to make this work in Windows with a Bitnami install last year and I never got it to work. I don't know if the problem was Windows or Bitnami or the virtual machine or I wasn't configuring it right. Give me a couple days to experiment to see if I can figure it out.
#823585
amosbatto wrote: Wed Mar 27, 2019 9:22 pm I tried to make this work in Windows with a Bitnami install last year and I never got it to work. I don't know if the problem was Windows or Bitnami or the virtual machine or I wasn't configuring it right. Give me a couple of days to experiment to see if I can figure it out.
Yeah sure. From my side, I too will investigate to be work. Waiting to hear the good result?
Last edited by jemiris on Wed Jan 22, 2020 3:51 am, edited 3 times in total.
#823623
Still, I have not got executed the cron.php file via windows. Have you got any idea?
* But I have with SCHTASK via command line and using User Interface in Windows 10.
* But I did not get any error in cron.log. But it did not work. Still, I'm finding difficulty in it.
Can you have any clues to execute my cron job in windows using a task scheduler?
Last edited by jemiris on Wed Jan 22, 2020 3:51 am, edited 1 time in total.

Experience heightened pleasure with Cenforce 100 M[…]

Get an instant solution to move emails to MBOX for[…]

Most Demanding OST to PST Converter

The most demanding OST to PST Converter is TrijaT[…]

Betvisa clone scripts are pre-built software solut[…]