# Command "mautic:campaigns:update " is not defined

**URL:** <https://forum.mautic.org/t/command-mauticupdate-is-not-defined/34374>\
**Category:** Product Support\
**Created:** [December 7, 2024, 8:01pm UTC](https://forum.mautic.org/t/command-mauticupdate-is-not-defined/34374 "2024-12-07T20:01:10Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Avocation](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/avocation/32/135_2.png) [@Avocation](https://forum.mautic.org/u/Avocation)\
**Post date:** [December 7, 2024, 8:01pm UTC](https://forum.mautic.org/t/command-mauticupdate-is-not-defined/34374/1 "2024-12-07T20:01:10Z")

</div>

**Your software**  
My Mautic version is: 5.1.0  
My PHP version is: 8.1.27  
My Database type and version is: MariaDB 10.6.18

**Your problem**  
My problem is:  
The CRON jobs are firing and causes errors in the server log every time they fire. The errors are the same for the mautic.campaigns.trigger, mastic.campaigns.update and mastic.segments.update cron jobs.

These errors are showing in the log:  
mautic.ERROR: Symfony\Component\Console\Exception\CommandNotFoundException: Command "mautic:campaigns:update " is not defined. Did you mean one of these? doctrine:schema:update mautic:campaign:delete-event-logs mautic:campaigns:execute mautic:campaigns:messagequeue mautic:campaigns:messages mautic:campaigns:rebuild mautic:campaigns:summarize mautic:campaigns:trigger mautic:campaigns:update mautic:campaigns:validate mautic:plugins:update mautic:segments:update (uncaught exception) at /var/www/html/vendor/symfony/console/Application.php line 720 while running console command `UNKNOWN` [stack trace] #0 /var/www/html/vendor/symfony/framework-bundle/Console/Application.php(116): Symfony\Component\Console\Application-\>find() #1 /var/www/html/vendor/symfony/console/Application.php(259): Symfony\Bundle\FrameworkBundle\Console\Application-\>find() #2 /var/www/html/vendor/symfony/framework-bundle/Console/Application.php(82): Symfony\Component\Console\Application-\>doRun() #3 /var/www/html/vendor/symfony/console/Application.php(171): Symfony\Bundle\FrameworkBundle\Console\Application-\>doRun() #4 /var/www/html/bin/console(16): Symfony\Component\Console\Application-\>run() #5 {main} {“hostname”:“ip-XXXXXXXXXX”,“pid”:187413}

Steps I have tried to fix the problem:  
Manually run the CRON job commands at CLI and they process okay (although zero actual updates or changes made - not a busy site) with no errors at runtime.  
Googled for answers to these log errors.

---

<div class="post-metadata">

**Author:** ![marcus42](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@marcus42](https://forum.mautic.org/u/marcus42)\
**Post date:** [December 8, 2024, 2:40am UTC](https://forum.mautic.org/t/command-mauticupdate-is-not-defined/34374/2 "2024-12-08T02:40:52Z")

</div>

This looks like a bad/wrong $PATH

Try this:  
`$ which php`

The, in your cron, use that output (i.e. /usr/local/bin/php) and replace  
`* * * * * php /path/to/your/console <your cmd>`  
with  
`* * * * * /usr/local/bin/php /path/to/your/console <your cmd>`

---

<div class="post-metadata">

**Author:** ![Avocation](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/avocation/32/135_2.png) [@Avocation](https://forum.mautic.org/u/Avocation)\
**Post date:** [December 8, 2024, 11:28am UTC](https://forum.mautic.org/t/command-mauticupdate-is-not-defined/34374/3 "2024-12-08T11:28:45Z")

</div>

Much appreciated @marcus42 - I implemented your suggestion, rebooted the server and checked the error log. Unfortunately, it seems to still be happening - here are the recent log entries detailing the error:

[2024-12-08T10:50:01.758796+00:00] mautic.ERROR: Symfony\Component\Console\Exception\CommandNotFoundException: Command "mautic:campaigns:update " is not defined. Did you mean one of these? doctrine:schema:update mautic:campaign:delete-event-logs mautic:campaigns:execute mautic:campaigns:messagequeue mautic:campaigns:messages mautic:campaigns:rebuild mautic:campaigns:summarize mautic:campaigns:trigger mautic:campaigns:update mautic:campaigns:validate mautic:plugins:update mautic:segments:update (uncaught exception) at /var/www/html/vendor/symfony/console/Application.php line 720 while running console command `UNKNOWN` [stack trace] #0 /var/www/html/vendor/symfony/framework-bundle/Console/Application.php(116): Symfony\Component\Console\Application-\>find() #1 /var/www/html/vendor/symfony/console/Application.php(259): Symfony\Bundle\FrameworkBundle\Console\Application-\>find() #2 /var/www/html/vendor/symfony/framework-bundle/Console/Application.php(82): Symfony\Component\Console\Application-\>doRun() #3 /var/www/html/vendor/symfony/console/Application.php(171): Symfony\Bundle\FrameworkBundle\Console\Application-\>doRun() #4 /var/www/html/bin/console(16): Symfony\Component\Console\Application-\>run() #5 {main} {“hostname”:“ip-XXX-XX-XX-XX”,“pid”:1088}  
[2024-12-08T10:55:02.186774+00:00] mautic.ERROR: Symfony\Component\Console\Exception\CommandNotFoundException: Command "mautic:campaigns:trigger " is not defined. Did you mean one of these? mautic:campaign:delete-event-logs mautic:campaigns:execute mautic:campaigns:messagequeue mautic:campaigns:messages mautic:campaigns:rebuild mautic:campaigns:summarize mautic:campaigns:trigger mautic:campaigns:update mautic:campaigns:validate (uncaught exception) at /var/www/html/vendor/symfony/console/Application.php line 720 while running console command `UNKNOWN` [stack trace] #0 /var/www/html/vendor/symfony/framework-bundle/Console/Application.php(116): Symfony\Component\Console\Application-\>find() #1 /var/www/html/vendor/symfony/console/Application.php(259): Symfony\Bundle\FrameworkBundle\Console\Application-\>find() #2 /var/www/html/vendor/symfony/framework-bundle/Console/Application.php(82): Symfony\Component\Console\Application-\>doRun() #3 /var/www/html/vendor/symfony/console/Application.php(171): Symfony\Bundle\FrameworkBundle\Console\Application-\>doRun() #4 /var/www/html/bin/console(16): Symfony\Component\Console\Application-\>run() #5 {main} {“hostname”:“ip-XXX-XX-XX-XX”,“pid”:1098}  
[2024-12-08T11:00:01.612913+00:00] mautic.ERROR: Symfony\Component\Console\Exception\CommandNotFoundException: Command "mautic:segments:update " is not defined. Did you mean one of these? doctrine:schema:update mautic:campaigns:update mautic:plugins:update mautic:segments:rebuild mautic:segments:update (uncaught exception) at /var/www/html/vendor/symfony/console/Application.php line 720 while running console command `UNKNOWN` [stack trace] #0 /var/www/html/vendor/symfony/framework-bundle/Console/Application.php(116): Symfony\Component\Console\Application-\>find() #1 /var/www/html/vendor/symfony/console/Application.php(259): Symfony\Bundle\FrameworkBundle\Console\Application-\>find() #2 /var/www/html/vendor/symfony/framework-bundle/Console/Application.php(82): Symfony\Component\Console\Application-\>doRun() #3 /var/www/html/vendor/symfony/console/Application.php(171): Symfony\Bundle\FrameworkBundle\Console\Application-\>doRun() #4 /var/www/html/bin/console(16): Symfony\Component\Console\Application-\>run() #5 {main} {“hostname”:“ip-XXX-XX-XX-XX”,“pid”:1109}  
[2024-12-08T11:05:02.040405+00:00] mautic.ERROR: Symfony\Component\Console\Exception\CommandNotFoundException: Command "mautic:campaigns:update " is not defined. Did you mean one of these? doctrine:schema:update mautic:campaign:delete-event-logs mautic:campaigns:execute mautic:campaigns:messagequeue mautic:campaigns:messages mautic:campaigns:rebuild mautic:campaigns:summarize mautic:campaigns:trigger mautic:campaigns:update mautic:campaigns:validate mautic:plugins:update mautic:segments:update (uncaught exception) at /var/www/html/vendor/symfony/console/Application.php line 720 while running console command `UNKNOWN` [stack trace] #0 /var/www/html/vendor/symfony/framework-bundle/Console/Application.php(116): Symfony\Component\Console\Application-\>find() #1 /var/www/html/vendor/symfony/console/Application.php(259): Symfony\Bundle\FrameworkBundle\Console\Application-\>find() #2 /var/www/html/vendor/symfony/framework-bundle/Console/Application.php(82): Symfony\Component\Console\Application-\>doRun() #3 /var/www/html/vendor/symfony/console/Application.php(171): Symfony\Bundle\FrameworkBundle\Console\Application-\>doRun() #4 /var/www/html/bin/console(16): Symfony\Component\Console\Application-\>run() #5 {main} {“hostname”:“ip-XXX-XX-XX-XX”,“pid”:1119}  
[2024-12-08T11:10:01.470374+00:00] mautic.ERROR: Symfony\Component\Console\Exception\CommandNotFoundException: Command "mautic:campaigns:trigger " is not defined. Did you mean one of these? mautic:campaign:delete-event-logs mautic:campaigns:execute mautic:campaigns:messagequeue mautic:campaigns:messages mautic:campaigns:rebuild mautic:campaigns:summarize mautic:campaigns:trigger mautic:campaigns:update mautic:campaigns:validate (uncaught exception) at /var/www/html/vendor/symfony/console/Application.php line 720 while running console command `UNKNOWN` [stack trace] #0 /var/www/html/vendor/symfony/framework-bundle/Console/Application.php(116): Symfony\Component\Console\Application-\>find() #1 /var/www/html/vendor/symfony/console/Application.php(259): Symfony\Bundle\FrameworkBundle\Console\Application-\>find() #2 /var/www/html/vendor/symfony/framework-bundle/Console/Application.php(82): Symfony\Component\Console\Application-\>doRun() #3 /var/www/html/vendor/symfony/console/Application.php(171): Symfony\Bundle\FrameworkBundle\Console\Application-\>doRun() #4 /var/www/html/bin/console(16): Symfony\Component\Console\Application-\>run() #5 {main} {“hostname”:“ip-XXX-XX-XX-XX”,“pid”:1185}  
[2024-12-08T11:15:01.902048+00:00] mautic.ERROR: Symfony\Component\Console\Exception\CommandNotFoundException: Command "mautic:segments:update " is not defined. Did you mean one of these? doctrine:schema:update mautic:campaigns:update mautic:plugins:update mautic:segments:rebuild mautic:segments:update (uncaught exception) at /var/www/html/vendor/symfony/console/Application.php line 720 while running console command `UNKNOWN` [stack trace] #0 /var/www/html/vendor/symfony/framework-bundle/Console/Application.php(116): Symfony\Component\Console\Application-\>find() #1 /var/www/html/vendor/symfony/console/Application.php(259): Symfony\Bundle\FrameworkBundle\Console\Application-\>find() #2 /var/www/html/vendor/symfony/framework-bundle/Console/Application.php(82): Symfony\Component\Console\Application-\>doRun() #3 /var/www/html/vendor/symfony/console/Application.php(171): Symfony\Bundle\FrameworkBundle\Console\Application-\>doRun() #4 /var/www/html/bin/console(16): Symfony\Component\Console\Application-\>run() #5 {main} {“hostname”:“ip-XXX-XX-XX-XX”,“pid”:1196}  
[2024-12-08T11:20:02.338071+00:00] mautic.ERROR: Symfony\Component\Console\Exception\CommandNotFoundException: Command "mautic:campaigns:update " is not defined. Did you mean one of these? doctrine:schema:update mautic:campaign:delete-event-logs mautic:campaigns:execute mautic:campaigns:messagequeue mautic:campaigns:messages mautic:campaigns:rebuild mautic:campaigns:summarize mautic:campaigns:trigger mautic:campaigns:update mautic:campaigns:validate mautic:plugins:update mautic:segments:update (uncaught exception) at /var/www/html/vendor/symfony/console/Application.php line 720 while running console command `UNKNOWN` [stack trace] #0 /var/www/html/vendor/symfony/framework-bundle/Console/Application.php(116): Symfony\Component\Console\Application-\>find() #1 /var/www/html/vendor/symfony/console/Application.php(259): Symfony\Bundle\FrameworkBundle\Console\Application-\>find() #2 /var/www/html/vendor/symfony/framework-bundle/Console/Application.php(82): Symfony\Component\Console\Application-\>doRun() #3 /var/www/html/vendor/symfony/console/Application.php(171): Symfony\Bundle\FrameworkBundle\Console\Application-\>doRun() #4 /var/www/html/bin/console(16): Symfony\Component\Console\Application-\>run() #5 {main} {“hostname”:“ip-XXX-XX-XX-XX”,“pid”:1209}

---

<div class="post-metadata">

**Author:** ![marcus42](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@marcus42](https://forum.mautic.org/u/marcus42)\
**Post date:** [December 8, 2024, 12:38pm UTC](https://forum.mautic.org/t/command-mauticupdate-is-not-defined/34374/4 "2024-12-08T12:38:57Z")

</div>

_Save yourself few minutes. No need to reboot._

_With Linux, you only have to reboot following a kernel update or a hardware change. Otherwise we only restart/reload services, not the physical/cloud server, when needed._

_i.e. The cronjob service must be reloaded after a crontab change (this is done automatically - no need to do anything upon saving the tab)_

The first thing that I would try is to run the cmd directly from the CLI (what you’ve already done).

If it does work (you’ve reported that yes it does), I would think about a session problem where the bin is nowhere to be found.

Or, second option, the cron that see the blank/space between the cmd and the argument as a new line/new cmd.

The solution to the first problem (session) is to either re-declare the $PATH variable or fully declare the bin path (in this case, the php bin path). Like that:  
`* * * * * /path/to/php /path/to/script`

The solution to the second problem would be to quote your cmd like so:  
`* * * * * php "/path/to/script argument --argument=variable"`

Both solutions combined:  
`* * * * * /path/to/php "/path/to/script argument --argument=variable"`

And while reading your initial post again, the second option (the blank) seems to be the current best bet.

\*\*And of course, you aren’t root. Right? Because a webmaster is never root. And always a regular permission-less user (i.e. can’t do server reboot/reload/restart). Otherwise you’ll 💯 break your web app, regardless of the framework.

---

<div class="post-metadata">

**Author:** ![Avocation](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/avocation/32/135_2.png) [@Avocation](https://forum.mautic.org/u/Avocation)\
**Post date:** [December 8, 2024, 7:26pm UTC](https://forum.mautic.org/t/command-mauticupdate-is-not-defined/34374/5 "2024-12-08T19:26:29Z")

</div>

Thanks @marcus42, I spotted what looks like an extra ‘space’ at then of the line too but in crontab -e I tried to check and delete any erroneous space but didn’t seem to be one.

I’m not sure I understand the:

> The solution to the second problem would be to quote your cmd like so:  
> `* * * * * php "/path/to/script argument --argument=variable"`

If my crontab lines read like the below - what change do I need to make to them?

> 0,15,30,45 \* \* \* \* /usr/bin/php /var/www/html/bin/console mautic:segments:update  
> 5,20,35,50 \* \* \* \* /usr/bin/php /var/www/html/bin/console mautic:campaigns:update  
> 10,25,40,55 \* \* \* \* /usr/bin/php /var/www/html/bin/console mautic:campaigns:trigger

---

<div class="post-metadata">

**Author:** ![marcus42](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@marcus42](https://forum.mautic.org/u/marcus42)\
**Post date:** [December 8, 2024, 8:04pm UTC](https://forum.mautic.org/t/command-mauticupdate-is-not-defined/34374/6 "2024-12-08T20:04:03Z")

</div>

That would be  
`0,15,30,45 * * * * /usr/bin/php "/var/www/html/bin/console mautic:segments:update"`

---

<div class="post-metadata">

**Author:** ![Avocation](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/avocation/32/135_2.png) [@Avocation](https://forum.mautic.org/u/Avocation)\
**Post date:** [December 9, 2024, 6:40am UTC](https://forum.mautic.org/t/command-mauticupdate-is-not-defined/34374/7 "2024-12-09T06:40:09Z")

</div>

@marcus42 thank you so much, I really appreciate you taking the time to share your knowledge nad help with my problem. This looks like it’s fixed it with no more entries appearing in the log.

Thanks again. 👍

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/1X/43c63600fe51440378769136903f1fa2a9a34102.png) [@system](https://forum.mautic.org/u/system)\
**Post date:** [December 10, 2024, 6:40pm UTC](https://forum.mautic.org/t/command-mauticupdate-is-not-defined/34374/8 "2024-12-10T18:40:30Z")

</div>

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.
