Serverpilot Cron Jobs For Mautic

Mautic Logo

If you have used Serverpilot to set up your server intending to host Mautic then here is how to add the cron jobs to keep everything running.

After logging in to your server with either the root or ubuntu user, you need to switch to the user that owns the app you have Mautic installed with. The default user is serverpilot, if you are on the free plan then all of your apps will run as the serverpilot user. You will need your password handy which is the same as the sftp password.

su serverpilot

Once switched you can edit the user's crontab with the command:

crontab -e

If you have not edited the crontab before then you will be prompted to select an editor. If you are new to command line editors then choose nano as it's the easiest to use.

The following are a general set of Mautic cron jobs, the first three are needed and most of the others are optional according to the features you are using. You can remove the ones you don't need or comment them out by starting the line with a #.

Before adding anything you need to change /marketing/ to the name of your app so that the paths are correct to your install (If you are not running as the serverpilot user then you need to change that as well)

To paste into the terminal you can use the right mouse button after copying in the standard way.

After adding the new jobs, if you are using nano as the editor, you can save the crontab by pressing ctrl + x and then y at the overwrite prompt.

php7.0-sp indicates that the task will be executed using php 7.0. You can switch that to another version if you wish but I've not had any problems running with this version.

If you want to receive notifications when the jobs run then you can uncomment the MAILTO line and add your email address.