• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Scheduled Task Firing Multiple times

davez

Member
This may be a new issue. However, it is solved by using Run Gating.

Just a heads up. I have a couple of different scripts that are triggered once a day. They take about 10 seconds to complete processing. What seems to have been happening was that during that 10 seconds (before it was complete) the site would re-trigger the processing (I'm guessing because another visitor triggered it). So, I noticed that it would run up to 4 different times. I'm logging the events.

The only reason this was a problem is because it fired off emails to users. So, users were getting multiple emails from the script. But I've turned on Run Gating within the cron and that seems to have solved the problem.
 
If you want to make sure a scheduled task is triggered exactly once (no matter if there's any or a lot frontend activity) you can also use "Use querystring" (and if you want to separate multiple scheduled tasks also "Query secret") and trigger the task(s) via a cron job on your server.
 
Perfect. Thank you. I hadn't noticed the new features...then again, maybe they have been new for many years.
 
You can use 'wget' from your OS's cron to hit a link on your server to trigger our scheduled tasks. Best done in conjunction with a "query secret" on the Fabrik task. Then in your OS cron ...

wget http://your.site/index.php?fabrik_cron=yoursecret

Set the OS cron to run at least as often as the settings in the Fabrik task.

-- hugh

I am planning to execute Cron once in a day, daily at 10am to send 5-20 Email notification to the users with the the help of PHP Script Plugin.

Looking for some serious tips from the Seniors:
  • Should it be like range of 5-10 10 * * * or just * 10 * * * . ?
  • What should be the ideal run in backend of fabrik schedule: 1 per min or 5 per min ?
  • What is recommendation to avoid sending multiple Email Notifications to the same user (Email address) . Do you recommend to create an additional field (0/1 radiobutton switch) which will get updated after execution of Task ?
Thank you in advance.
 
I had difficulty getting cron job working, so I reverted to using the Use Run Gating feature which has worked properly, but I've only been testing for a few days. The fear is that the script could fail and leave the scheduled task unpublished, and the entire tasks stops working.

What went wrong with my Use Querystring set up? Not sure. The cron job would fire properly. It would trigger the Fabrik scheduled task script using the Require Querystring option and a Secret. The Fabrik scheduled task would reset the date ran (so it only ran once per day). But the script would not actually run. I'm wondering if had something to do with the wget command never completing the page load. I have my code entered into the "PHP Code" section of the scheduled task. It works fine if I run it any other way than the Require Querystring option. That said, it did work using the Use Querystring option, but not reliably (for me). For testing, I set the cron job to one minute and would reset the Schedule Task Date manually, when I wanted it to re-run. I also added a script that would log the start and completing of the script, just in case.

The way I set it up was to run both the cron job and scheduled task once per day. However, I have not tried having the cron job fire more often than once a day. You could have it fire once per hour for a once a day scheduled task. Every time the scheduled task runs, it resets the date/time, so it won't fire again until the next day, even if the cron job calls the wget again using the Require querystring option. I may try this, but my scripts are live, so I need them to reliably work now.

The original problem was that the script took long enough for it to run, that the script was being fired multiple times until the initial firing completed. Run Gating solves this, as will using Require Querystring, if you can get it to work properly.

Oh, and I do have a radio button switch to store whether the mail was sent in a table, but the only reason I have that is just for storing the data. My scripts are time sensitive, so I send it once during a 24 hour time window.
 
Hi Davez,

Your post is very helpful, but I'm struggling a bit to get just what I need and hopefully, you can help.

I am using the import csv plugin and I need it to import a file once every top of the hour. I have created a cron job on my server using wget and it runs without fail at the top of each hour. However, I'm not sure what my setting should be in the Fabrik scheduler to make sure that when the cron job runs, the plugin runs also.

As a fall back, currently, I have the cron job running every 30 minutes and the scheduler is set to run every 30 minutes. Sometimes the plugin will run with the cron job and other times not. It appears that the Last Run time changes on its own (like 30 min later) and so it does not run with the next cron job. I'm attaching a screenshot of my settings.

Any ideas what I am doing wrong? Is there a way for a cron job to run the plugin directly bypassing the Scheduler? I am running fully updated Joomal 3.9.15

Thanks.
 

Attachments

  • FabrikScheduler020420.png
    FabrikScheduler020420.png
    114.6 KB · Views: 126
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top