3

I want to set cron jobs for my Mautic install, but I don't know what path to use ...

This is NOT for a Bitnami mautic install, I'm simply using examples below for reference, this is for a Google Cloud Deploy instance.

Mautic install is over here:

http://35.233.141.211/s/login

  1. What is the path to my mautic installation
  2. In what file should I put the cron code or where should I create a new file?
  3. What path should I enter into the mautic cron job command

This the info and data I have now:

Siteground hosting:

15 * * * * /usr/local/bin/php /home/vuxi5632/public_html/brunovincent.net/mautic_yh/bin/console mautic:campaigns:update >/dev/null 2>&1

Bitnami Documentation

15 * * * * su daemon -s /bin/sh -c "installdir/php/bin/php installdir/apps/mautic/htdocs/app/console mautic:segments:update --env=prod"

Mautic forum post suggestion:

1 * * * * su daemon -s /bin/sh -c “/opt/bitnami/php/bin/php -q /opt/bitnami/apps/mautic/htdocs/app/console mautic:segments:update” #mautic-segments-cron

Google Cloud: Not sure, but I have these 3 bits of information:

I ran this command in command prompt:

~# grep -i 'DocumentRoot' /etc/apache2/sites-available/000-default.conf

And I got this:

/var/www/html/mautic

My IP address is this:

http://35.233.141.211/s/dashboard

My Google cloud sign in comand is this:

gcloud beta compute ssh --zone "us-west1-a" "mautic-google-deploy-vm" --project "horizon-private-charters"

Command prompt path on my windows PC:

root@mautic-google-deploy-vm:~#

What is the EXACT code in need to input into the file?

  • Okay, let's try to follow the [guide](https://mauteam.org/mautic/mautic-admins/mautic-cron-jobs-for-dummies-marketers-too/) I mentioned in my answer and check your deployment. You've checked `DocumentRoot` and found path `/var/www/html/mautic` just as in the guide. Please check this path `/var/www/html/app/console` as well. To do it run `ls -l /var/www/html/app/` and update your question with a result. Also, please check configured cron jobs with command `sudo crontab -e` and add update your question with output. – Serhii Rohoza Oct 01 '20 at 07:51

1 Answers1

2

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:

  1. 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
  1. Connect to the VM instance via SSH:
$ gcloud compute ssh mautic-1-vm --zone us-east4-a
  1. 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
  1. 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

  1. What is the path to my mautic installation

It depends how you installed Mautic.

  1. 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.

  1. 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.

Serhii Rohoza
  • 1,424
  • 2
  • 5
  • 15
  • Wow, thank you so much, but I'm such an idiot...this is NOT a mautic insall, it's a google cloud deploy, mautic is defective ,that's my whole problem.. – Bruno Vincent Oct 01 '20 at 01:01