Here's what Mautic should do to take the pain and guesswork out of cron setup!

In the very first step of a SuiteCRM installation the user gets the following (among other things):

Quote:
To Setup Crontab
Note: In order to run SuiteCRM Schedulers, add the following line to the crontab file:
* * * * * cd /home/xxxxxxxxxxx/public_html/crm; php -f cron.php > /dev/null 2>&1

And I immediately thought to myself:
Wow! That's super convenient and takes all the pain/guesswork out of a cron job setup!
Why couldn't Mautic make it so easy?


I thought I need to post it here as a suggestion.
I think even pros who know everything about cron setup would appreciate such an easy, personalized copy&paste solution and probably everyone would prefer this.

It would be great if under configuration Mautic would add a page that lists ALL potentially useful cron commands/lines in this personalized manner.

Note: for privacy, I replaced my username with "xxxxxxxxxxx" above.

@arjon If you otherwise use e.g. planned tasks from Plesk to setup your cronjobs, it might be that they get fired in parallel or in any order (see tweets). The script works step by step. I can’t fully explain, but this seems to have solved some problems we had before. No more messages about a required force option to run the script.

[quote=13087:@dirk_s]sure. we called it “cronjob.sh” and made it executable

#!/bin/sh php /PATHTOMAUTIC/app/console mautic:segments:update php /PATHTOMAUTIC/app/console mautic:campaigns:update php /PATHTOMAUTIC/app/console mautic:campaigns:trigger

Now we run “cronjob.sh” each 5 minutes.[/quote]
I don’t get the point why is this better? What about email trigger? Wouldn’t it interfere with the script(so -f is needed)?

And no, personally, I don’t have any trouble setting up cron jobs.
But having PERSONALIZED cron job commands that I just need to copy and paste
would be SUPER CONVENIENT even for guys like me.

[quote=13085:@dirk_s]@arjon Running one cron job would eliminate errors, that currently arise from cron jobs running in parallel or in the wrong order. We had trouble with cron jobs, that very often didn’t run and asked for -f to force a run.

We now setup a single script started by cron job, which calls each command in the right order sequentially. Trouble gone.[/quote]
Can you share the script? Maybe it would be useful to other people here. Personally i have had a few problems and i had to use -f argument.

sure. we called it “cronjob.sh” and made it executable

#!/bin/sh php /PATHTOMAUTIC/app/console mautic:segments:update php /PATHTOMAUTIC/app/console mautic:campaigns:update php /PATHTOMAUTIC/app/console mautic:campaigns:trigger

Now we run “cronjob.sh” each 5 minutes.

@MxyzptlkFishStix
You have completely missed my point!
I’ve read the documentation. The documentation doesn’t provide any personalized cron commands.
The user has to fiddle the correct path together.
Go ahead and count how many times users have struggled with the cron job set up.
And even most pros will probably appreciate an option where they can just copy and paste cron commands instead of having to manually adjust each of them to match their server path.

@arjon
Is it really so difficult to understand what I meant in my initial post here?
Where did I say that I’d want “only one cron for everything?”
Nowhere.
Let me copy and paste a sentence from my original post for you:
It would be great if under configuration Mautic would add a page that lists ALL potentially useful cron commands/lines in this PERSONALIZED manner.
Did you catch that?
… in this PERSONALIZED manner.
In case you don’t know what “personalized” means:
It means: the user doesn’t need to fiddle with the cron command because he/she would already get the correct server path in those personalized commands and would just need to copy and paste them.
Which is not only super convenient but would also eliminate all those support requests related to cron job setup.
Because even a total dummy would be able to do it if you give them the exact path for THEIR server.

Geez! I didn’t think that such a simple idea would be so difficult to grasp!

@arjon Running one cron job would eliminate errors, that currently arise from cron jobs running in parallel or in the wrong order. We had trouble with cron jobs, that very often didn’t run and asked for -f to force a run.

We now setup a single script started by cron job, which calls each command in the right order sequentially. Trouble gone.

[quote=13055:@alexb]In the very first step of a SuiteCRM installation the user gets the following (among other things):

And I immediately thought to myself:
Wow! That’s super convenient and takes all the pain/guesswork out of a cron job setup!
Why couldn’t Mautic make it so easy?

I thought I need to post it here as a suggestion.
I think even pros who know everything about cron setup would appreciate such an easy, personalized copy&paste solution and probably everyone would prefer this.

It would be great if under configuration Mautic would add a page that lists ALL potentially useful cron commands/lines in this personalized manner.

Note: for privacy, I replaced my username with “xxxxxxxxxxx” above.[/quote]

You want only one cron for everything? I don’t see how is that convenient. I run one cron every 10 minutes but another one every hour. Cronjobs are not complicated with this setup. They are very easy. If you think you need detailed help, check this forum out. There are a lot of threads about cronjobs.

@joshuabuildsthings
My proposal above has nothing to do with wp-cron or the way WordPress does it.
Instead, it’s about a “proper” cron job setup that does not depend on page loads.

What SuiteCRM does in that first installation step is simply give the user the exact cron command the user needs for his/her server.
All you have to do is to go to the cron section in cPanel and paste that command in.
That makes cron setup a breeze and is super convenient.
Plus, it would eliminate support requests like this:
https://www.mautic.org/community/index.php/4895-step-1-mautic-installation-problem/p1#p13047

@alexb - Nice catch. I believe WordPress does something similar with wp-cron.

The wp-cron setup is embedded in page loads instead of using the system cron, and exposes scheduling functions to user code which make using and configuring it a breeze for users. The drawback of using page loads to execute it is that it sometimes weighs down page load, and isn’t executed as consistent intervals.

In the very first step of a SuiteCRM installation the user gets the following (among other things):

[quote]To Setup Crontab
Note: In order to run SuiteCRM Schedulers, add the following line to the crontab file:

          • cd /home/xxxxxxxxxxx/public_html/crm; php -f cron.php > /dev/null 2>&1[/quote]
            

And I immediately thought to myself:
Wow! That’s super convenient and takes all the pain/guesswork out of a cron job setup!
Why couldn’t Mautic make it so easy?

I thought I need to post it here as a suggestion.
I think even pros who know everything about cron setup would appreciate such an easy, personalized copy&paste solution and probably everyone would prefer this.

It would be great if under configuration Mautic would add a page that lists ALL potentially useful cron commands/lines in this personalized manner.

Note: for privacy, I replaced my username with “xxxxxxxxxxx” above.

@alexb - I’m aware that SuiteCRM is using a “proper” cron, and WordPress is using a hacky technique; I described the difference in my first response. However, advanced WordPress configuration recommends setting wp-cron to execute via a proper cron tab event, giving the wp-cron setup a potential leg up.

What I find interesting and potentially useful about the wp-cron method is that cron events are consolidated and managed by that one script, and can be extended by the user to trigger custom events. It opens a world of possibilities for plugin development.

If we were to combine the two methods; a single point of cron management like wp-cron, with a copy & paste set up for users to configure cron to execute that cron management file from a proper cron tab, we would have a very friendly user experience and would probably expedite plugin development by simplifying what it takes to have events triggered at intervals within the system.

What about email trigger? how do you run it? I need to run all triggers every 5 minutes (except email which is run every 30)