jethro-pmm icon indicating copy to clipboard operation
jethro-pmm copied to clipboard

Thoughts on reducing the number of cron jobs in a jethro installation?

Open s4069b opened this issue 1 year ago • 1 comments

The /scripts folder in Jethro has a number of handy scripts which run using cron and .ini files. I have a load of cron jobs setup, mainly using mailchimp_sync.php, email_report.php and roster_reminder.php. Back in 2018 the idea of moving from ini files to gui was bounced around... but I don't think it ever got picked up.

I've been thinking a little about email_report.php and roster_reminder.php in particular. And the idea of having one generic cron job in the background, and doing away with the ini files.

What about having another menu-option here, like "report by email": Screenshot 2023-08-29 at 10 37 56 am

And have a screen/view where you can select a report from a dropdown list, and select the day of week and time of day, plus a 'group' or 'user' to whom you would like the report to be regularly sent. Maybe also a spot to put a comment?

And then the option to add another report email ...

On the screen you'll see a list of current report email and their timing/recipients. Screenshot 2023-08-29 at 10 54 01 am

In our case, this could do away with a number of cron jobs and ini (eg. Monday Morning email report to pastoral care people with a list of those who have missed church for three weeks, various reminders for renewal of child safety details for volunteers, list of newcomers for follow-up etc etc. Then Thursday's birthday reminders to the Sunday School teachers etc etc. In our case we could remove about 7-10 cron jobs and ini files).

Then we come to roster_reminders.php. Similar thinking. What about another menu item here, say 'Roster Reminder emails": Screenshot 2023-08-29 at 10 41 39 am

Then create a new page with a dropdown to select roster views which you would like to create email reminders for. Select the day of week and time of day, and the 'group' to whom you would like the email sent. Perhaps the ability to add a 'message' before or after?

In our case this would do away with at least three more cron jobs and ini files (eg Tuesday's music roster reminder, Thursday's kids ministry reminder, Fridays morning tea/dinner reminder etc etc).

Any other interest or thoughts?

It would be nice to have a big umbrella cron job set-up once which runs a script that interacts with the jethro database in such a way that allows us to add roster reminders and email reports via the jethro-pmm gui.

Yes it would. But we'd need to do a fair bit of work to build GUIs for all the various scripts (mailchimp sync, date reminder, email report, roster reminder) - all of which might have several instantiations (eg two different reports sent out at different frequencies). A good first step (in another issue) might be to mock up some interfaces and we could go from there. But in the meantime INI files, whilst not beautiful, are quick and cheap!

Originally posted by @tbar0970 in https://github.com/tbar0970/jethro-pmm/issues/403#issuecomment-363741613

s4069b avatar Aug 29 '23 00:08 s4069b

There is probably some third-party library which would handle "internal cron" for us. So that the system cron calls some script every hour/whatever, and the library works out which tasks to actually perform.

tbar0970 avatar Aug 30 '23 02:08 tbar0970