Have a look at the Mautic documentation Cron jobs:
Mautic requires a few cron jobs to handle some maintenance tasks such
as updating contacts or campaigns, executing campaign actions, sending
emails, and more. You must manually add the required cron jobs to your
server.
and
If you're new to Linux or Cron Jobs, then the Apache Foundation has an
excellent guide which we would suggest that you read before asking
questions via the various support channels.
In case of Mautic Certified by Bitnami installed from Marketplace, you should follow steps below:
- Install Mautic Certified by Bitnami (optional).
$ gcloud compute instances list
NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS
mautic-1-vm us-east4-a f1-micro 10.150.0.3 34.86.XX.181 RUNNING
- Connect to the VM instance via SSH:
$ gcloud compute ssh mautic-1-vm --zone us-east4-a
- Check Bitnami Mautic documentation Configure Scheduled Tasks:
Before running the commands shown on this page, you should load the
Bitnami stack environment by executing the installdir/use_APPNAME
script (Linux and MacOS) or by clicking the shortcut in the Start Menu
under “Start -> Bitnami APPNAME Stack -> Application console”
(Windows). On OS X VMs, the installation directory is /opt/bitnami and
OS X VM users can click the “Open Terminal” button to run commands.
Learn more about the Bitnami stack environment and about OS X VMs.
mautic-1-vm:~$ cd /opt/bitnami/
mautic-1-vm:/opt/bitnami$ sudo ./use_mautic
- Edit Cron jobs:
bash-5.0# sudo crontab -e
I decided to use nano
as an editor on this step:
1 * * * * su daemon -s /bin/sh -c "/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/bin/console mautic:segments:update" #mautic-segments-cron
1 * * * * su daemon -s /bin/sh -c "/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/bin/console mautic:campaigns:rebuild" #mautic-campaings-rebuild-cron
1 * * * * su daemon -s /bin/sh -c "/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/bin/console mautic:campaigns:trigger" #mautic-campaigns-trigger-cron
1 * * * * su daemon -s /bin/sh -c "/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/bin/console mautic:emails:send" #mautic-email-send-cron
1 * * * * su daemon -s /bin/sh -c "/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/bin/console mautic:webhooks:process" #mautic-webhooks-cron
As I can see, Cron jobs were configured by Bitnami, but you can make some changes if needed (it looks like mautic:campaigns:update
was missed, but other optional jobs were added)
In case of manual Mautic installation, you can follow this 3rd party guide Mautic Cron Jobs – The Full Guide for 2020:
The path:
For servers running Debian, Ubuntu and Derivatives use:
grep -i 'DocumentRoot' /etc/apache2/sites-available/000-default.conf
For servers running CentOS, RHEL and Fedora Linux distributions, run:
$ grep -i 'DocumentRoot' /etc/httpd/conf/httpd.conf
This command will return something like:
DocumentRoot /var/www/html/mautic
and
So, let’s say your path (DocumentRoot) is “/var/www/html/”
Then your cron jobs would be like this:
* * * * * php /var/www/html/app/console mautic:segments:update
* * * * * php /var/www/html/app/console mautic:campaigns:update
* * * * * php /var/www/html/app/console mautic:campaigns:trigger
Than you can use the same command sudo crontab -e
to edit Cron jobs.
EDIT
- What is the path to my mautic installation
It depends how you installed Mautic.
- In what file should I put the cron code or where should I create a new file?
You should use command sudo crontab -e
to open proper file.
- What path should I enter into the mautic cron job command
Cron jobs for Mautic Certified by Bitnami configured "out of the box" (you can see path in my example), path for manual installation you can find at web server configuration as it was described above.