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.
By JonathanMiller
#830367
I was wondering what the certified ProcessMaker approach was to configuring a plugin's cron execution to be nightly when the cron.php itself is executed every 5 minutes? Currently I'm thinking I need to check if an execution is the first execution of a new day and if that is the case do my work and then somehow store that the work has been done for the day.

I'm using ProcessMaker 3.5.7 if that is needed. I've been doing a real deep dive into plugin development so any information is helpful.

My cron is:
*/5 * * * * /usr/bin/php -f "/opt/processmaker-3.5.7/workflow/engine/bin/cron.php" plugins
By zetisop
#830794
These unassuming lines of code hold the Geometry Dash key to orchestrating a symphony of tasks, ensuring seamless operations, and maximizing efficiency in a variety of applications.
User avatar
By raavikant
#830803
You're on the right track with your thinking, and it is possible to set up a nightly cron job within a plugin in ProcessMaker even when the main cron.php is executed every 5 minutes.
By Mikasa
#830852
You mentioned that you need to store that the work has been done for the day. You can achieve this by using some form of persistent storage.
Code: Select all
<?php
// Check if it's a new day
$currentDate = date('Y-m-d');
$lastExecutionDate = getLastExecutionDate(); // Retrieve from your persistent storage

if ($currentDate !== $lastExecutionDate) {
    // Perform your nightly tasks here
    performNightlyTasks();

    // Update the last execution date
    updateLastExecutionDate($currentDate); // Store in your persistent storage
}

function getLastExecutionDate() {
    // Implement fetching last execution date from your storage
    // Example: return $lastExecutionDate;
}

function updateLastExecutionDate($newDate) {
    // Implement updating last execution date in your storage
    // Example: $lastExecutionDate = $newDate;
}
?>
By indignantsacred
#831659
Mikasa wrote: Mon Aug 28, 2023 2:48 am You mentioned that you need to store that the work has been done for the day. You can achieve this by using some form of persistent storage.
Code: Select all
<?php
// Check if it's a new day
$currentDate = date('Y-m-d');
$lastExecutionDate = getLastExecutionDate(); // Retrieve from your persistent storage

if ($currentDate !== $lastExecutionDate) {
    // Perform your nightly tasks here
    performNightlyTasks();

    // Update the last execution date
    updateLastExecutionDate($currentDate); // Store in your persistent storage
}

function getLastExecutionDate() {
    // Implement fetching last execution date from your storage
    // Example: return $lastExecutionDate;
}

function updateLastExecutionDate($newDate) {
    // Implement updating last execution date in your storage
    // Example: $lastExecutionDate = $newDate;
}
?>
Is this the command used to set up daily job archiving?
By wilkinsonwilfrid
#831844
It is indeed feasible to configure a nightly cron job inside a ProcessMaker plugin, as you correctly pointed out; this is true even when the main cron.php file is processed every 5 minutes.

A Dream11 clone script is a pre-made software solu[…]

A stake clone script is a pre-designed, error-free[…]

The Aviator casino game script clone script replic[…]

The ZED RUN Clone Script by Dappsfirm replicates t[…]