How to add mautic cron job in plesk

Your software
My Mautic version is: 3.3.1
My PHP version is: 7.4
My Database type and version is:My Sql

Your problem
My problem is:

I need to run mautic cron job in plesk.

This is the command:

php /var/www/vhosts/ mautic:segments:update

I tried running this command as it is but it is not working and I have also tried running /usr/ bin /php /var/www/vhosts/ mautic:segments:update still it is not working because when I run a command on ssh /usr/ bin /php

I get the following output:
-bash: /usr/local/bin/php: No such file or directory

How do I run this cron job please help me resolve this issue…

add this to the beginning of your cron jobs right before php
/opt/plesk/php/7.4/bin/ if you run PHP 7.4
/opt/plesk/php/7.3/bin/ in you run PHP 7.3

Looks like this:
/opt/plesk/php/7.4/bin/php /var/www/vhosts/ mautic:campaigns:update

1 Like

I will try this and update you if it works…

1 Like

@EJL This is not working…

Hey @EJL there was a mistake from my side that is why it was not working. I was using app/console instead of bin/console… So once I correct it. It started working…

Thank you so much for your help…

1 Like

Excellent. Here’s a pro tip. Copy it up to the “console” portion and paste to a Google doc about a dozen times. Then add the mautic:xxxx:xxx for the most frequent commands, the update commands, and whatever else is useful .

Here is a snippet of my cheat sheet (I use it daily)

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ mautic:update:find

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ mautic:update:apply

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ mautic:update:apply --finish

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ -s

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ mautic:segments:update --batch-limit 1000 -f -vvv --max-contacts 100

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ mautic:segments:rebuild --batch-limit 1 -f -vvv --bypass-locking

mautic:segments:update [-b|–batch-limit [BATCH-LIMIT]] [-m|–max-contacts [MAX-CONTACTS]] [-i|–list-id [LIST-ID]] [-f|–force] [–bypass-locking] [-t|–timeout TIMEOUT] [-x|–lock_mode LOCK_MODE] [-h|–help] [-q|–quiet] [-v|vv|vvv|–verbose] [-V|–version] [–ansi] [–no-ansi] [-n|–no-interaction] [-e|–env ENV] [–no-debug] [–]

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ mautic:segments:rebuild --batch-limit 500 --list-id 196 -f -vvv

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ mautic:campaigns:update --batch-limit 1 -f -vvv

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ mautic:campaigns:rebuild -f -vvv

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ mautic:campaigns:trigger --batch-limit 100 -f -vvv --campaign-id 1

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ mautic:import --id 15726 -f -vvv

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ mautic:import:directory -vvv

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ mautic:import:parallel -vvv

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ mautic:emails:send

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ mautic:iplookup:download -vvv

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ mautic:emails:fetch -vvv

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ mautic:unusedip:delete

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ mautic:emails:send -f

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ mautic:segments:rebuild

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ cache:clear -vvv

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ mautic:plugins:update

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ swiftmailer:email:send

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ swiftmailer:spool:send --message-limit=10 --time-limit=10 --recover-timeout=900 --mailer=default

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ mautic:queue:process

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ doctrine:schema:update --force

/var/www/vhosts/ doctrine:schema:update --force

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ doctrine:schema:update --env=prod --force

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ doctrine:schema:validate

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ doctrine:migrations:migrate

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ mautic:migrations:generate

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ mautic:broadcasts:send --channel=sms

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ mautic:campaigns:messages --channel=sms

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ mautic:campaigns:validate

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ mautic:contacts:deduplicate

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ mautic:emails:fetch --message-limit 500

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ debug:swiftmailer

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ mautic:social:monitoring

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ -s
/opt/plesk/php/7.4/bin/php /var/www/vhosts/ -s
/opt/plesk/php/7.4/bin/php /var/www/vhosts/ -s
/opt/plesk/php/7.4/bin/php /var/www/vhosts/ -s
/opt/plesk/php/7.4/bin/php /var/www/vhosts/ -s
/opt/plesk/php/7.4/bin/php /var/www/vhosts/ -s

/opt/plesk/php/7.4/bin/php /var/www/vhosts/ -s
/opt/plesk/php/7.4/bin/php /var/www/vhosts/ -s
/opt/plesk/php/7.4/bin/php /var/www/vhosts/ -s
/opt/plesk/php/7.4/bin/php /var/www/vhosts/ -s
/opt/plesk/php/7.4/bin/php /var/www/vhosts/ -s
/opt/plesk/php/7.4/bin/php /var/www/vhosts/ -s
/opt/plesk/php/7.4/bin/php /var/www/vhosts/ -s
/opt/plesk/php/7.4/bin/php /var/www/vhosts/ doctrine:schema:update --force

1 Like