Fabrik Schedule with email plugin only works when manually run

Bren

Member
Hello all.
I have a Fabrik Schedule with an email plugin that only seems to work properly when I manually run it. It does run on it's own; but the condition always fails to return any records (though the records are really true). If I manually run it and the conditions are still true then it does return records via email. Below is my condition within the schedule email plugin.
Code:
$reminderdate = $row->bw_resources___reminder_date;
$reminderdate = DateTime::createFromFormat("m-d-Y l", $reminderdate);
$reminderdate = date_format($reminderdate, 'm-d-Y');
$todaysdate = date("m-d-Y");
return $reminderdate == $todaysdate;
I'm using Fabrik 3.4 & Joomla 3.4.8. Any suggestions?
Thanks in advance.
 
Hi Troester.
Oh man. Do lists always need public view access for a related schedule to work? That would explain why my other schedule doesn't work anymore either. All of my lists are private access only. I'm trying to have dates in a list have automated email reminders based on the date. Is there anyway around this? If not; maybe another way to do the same thing?
Thanks in advance.
 
I went ahead and copied this list. Then I changed the copied list access level to public. Then I changed the schedule email list to this copied public list. Now I'm waiting to see if the schedule fires on it's own tomorrow; as I also have a couple records with reminder dates set to tomorrow. I just wish I knew when it will fire the schedule. It seems to fire once at random times of the day. Wish I could set it to a specific time (like 7am each day).
 
As per troester's response ... the main Fabrik scheduler plugin can only run when a page is loaded. There is no real "scheduling" in Joomla, as that would be very operating system dependent. So what we do is, we have a plugin that runs as the very last thing at the end of each page load of any J! page, which looks to see if there are any scheduled tasks which are on or past their next run time. So that only works if your front end pages are being loaded often enough to trigger the process.

So, as per troester, the best workaround for that is to set up your own server cron job - either through something like CPanel, or maybe an online cron service, and fire off a "wget http://your.site/path/to/joomla", with an optional query string arg (see scheduled task plugin tooltips or the wiki) at the time you want the job to run.

-- hugh
 
So, created a Cron Job in my cPanel with the following command (I added a query secret instead of =1).
Code:
wget 'http://gilesoffice.com/index.php?fabrik_cron=resourcereminder'
The Cron Job forwards me an email when it fires and show results. It seems to still have an issue where it gets redirected to my home page where my login is. So, I didn't receive an email from the Fabrik schedule (like I do when I run it). Any suggestions?
Thanks in advance.
 
Actually, I just tried using the following =2 (instead of the query secret) and it appears to have worked.
Code:
wget http://gilesoffice.com/index.php?fabrik_cron=2
I'll see what happens when it fires in the morning.
 
Hi Hugh.
The Cron Job fired this morning; but this time it didn't work. No auto-email from the true condition in a related record today. I'm now wondering if this has to do with the Fabrik schedule set to run once every day and my Cron Job tried to run it within 24 hours of my last test run? Or does the "Require querystring = yes" setting turn off (ignores) the "Run" "Every" & "Unit" settings; since the Cron Job schedule in cPanel takes care of when it fires?
Thanks in advance.
 
I usually set the cron job to run twice a day, when I've set the frequency to 24 hours. It'll only run once a day, but you don't run in to any 'time window' issues.

I have been thinking about adding a "run on demand" option, to combine with the querystring trigger, but it's actually harder than you'd think, just because of the way the plugin was written, assuming a schedule. I'll take another look soon.

-- hugh
 
Hi Hugh.
OK. So, I just adjusted my Fabrik Schedule settings. Could I trouble you to look at the attached snippet pic of my settings to see if I set it to twice a day correctly? Also attached is a snippet pic of my related cPanel Cron Job to fire every week day morning at 5:30am. Does it look like I have both of the attached settings correctly set?
Thanks in advance.
 

Attachments

  • FabrikScheduleSettings.JPG
    FabrikScheduleSettings.JPG
    63.6 KB · Views: 278
  • cPanelCronJobSettings.JPG
    cPanelCronJobSettings.JPG
    19.3 KB · Views: 279
To run twice it would be something like 5,17 in the hour.

And I'd use a querystring specific to that task. I tested that yesterday and it definitely works. Like 'foobar' (no quotes) in the querystring setting, and fabrik_cron=foobar
 
OK. Thank you, Hugh.
I just revised my settings; per the attached. Now I'll wait to see what happens in the morning.
You have a great day, Hugh.
 

Attachments

  • FabrikScheduleSettings-Revised.JPG
    FabrikScheduleSettings-Revised.JPG
    72.7 KB · Views: 268
  • cPanelCronJobSettings-Revised.JPG
    cPanelCronJobSettings-Revised.JPG
    20.3 KB · Views: 250
Morning Hugh.
So, the Cron Job fired this morning; but the Fabrik schedule auto-email did not run (and the condition of a related record was true again). Below is the auto-email from my cPanel Cron Job this morning.

--2016-02-25 05:30:03-- http://gilesoffice.com/index.php?fabrik_cron=resource
Resolving gilesoffice.com... 192.254.233.206
Connecting to gilesoffice.com|192.254.233.206|:80... connected.
HTTP request sent, awaiting response... 303 See other
Location: /index.php/component/users/?view=login [following]
--2016-02-25 05:30:04-- http://gilesoffice.com/index.php/component/users/?view=login
Reusing existing connection to gilesoffice.com:80.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: `index.php?fabrik_cron=resource'

0K .......... 319M=0s

2016-02-25 05:30:05 (319 MB/s) - `index.php?fabrik_cron=resource' saved [10858]

If I paste into my web browser the URL "http://gilesoffice.com/index.php?fabrik_cron=resource" then I'm redirected to my site's login page. So, maybe I'm still having a access level issue?
Attached is a snippet pic of my related copied list where I set the view access levels to public. Also, attached is the Fabrik schedule where I have this public list selected. I just noticed that the 5,17 hour setting only accepted 5 yesterday. So, I just tried updating with 5,17 (as you recommended) and it still only accepted 5?
Also, it's worth mentioning that this copied list has no menu items to get to it at this point from the front end (as my entire site is private with only authorized user access). Could this be an issue, too?
Thanks in advance, Hugh. I hope to hear from you soon.
 

Attachments

  • List Access level settings.JPG
    List Access level settings.JPG
    46.3 KB · Views: 261
  • FabrikScheduleSettings-Revised.JPG
    FabrikScheduleSettings-Revised.JPG
    73.3 KB · Views: 248
How did you add this general login?
I assume you'll need a URL which is accessible for Public.
I would try to create one "free" menu item and use this in the cron job.

BTW: If you are doing anything sensitive I would change the QS secret and won't publish it here.
 
Can you have a look in the #__fabrik_log table, and see if it looks like our cron plugin is firing?

We should add a log line to that table whenever the plugin fires, it'll be message_type plg.cron.email.

I'm just not entirely sure if the J! plugin hook we use to fire the cron plugin (onAfterRender) would run in those circumstances.

-- hugh
 
Hi Troester & Hugh.
Thanks for the great suggestions.
I'll try adding the menu item and adjust my QS secret.
Attached is a snippet pic of the Fabrik_log (most recent records). Looks like there are records from this morning around when the Cron job fired (and even earlier this morning at 2am?). Does this help answer any questions?
Thanks in advance, guys.
 

Attachments

  • fabrik_log-2-25-16.JPG
    fabrik_log-2-25-16.JPG
    99.1 KB · Views: 262
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top