# Mautic CronJobs

**URL:** <https://forum.mautic.org/t/mautic-cronjobs/34167>\
**Category:** Product Support\
**Created:** [November 18, 2024, 11:59pm UTC](https://forum.mautic.org/t/mautic-cronjobs/34167 "2024-11-18T23:59:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![useradminuser2](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/useradminuser2/32/12727_2.png) [@useradminuser2](https://forum.mautic.org/u/useradminuser2)\
**Post date:** [November 18, 2024, 11:59pm UTC](https://forum.mautic.org/t/mautic-cronjobs/34167/1 "2024-11-18T23:59:11Z")

</div>

**Your software**  
My Mautic version is: v5.1.1  
My PHP version is: 8.1.29  
My Database type and version is: pdo\_mysql, 5.7.44

**Your problem**  
My problem is:  
I am trying to install cronjobs to run the required mautic php commands automatically. Using crontab -e, I placed these 3 lines at the bottom of the file:

- 
  - 
    - 
      - 
        - php /var/www/html/bin/console mautic:segments:update

- 
  - 
    - 
      - 
        - php /var/www/html/bin/console mautic:campaigns:update

- 
  - 
    - 
      - 
        - php /var/www/html/bin/console mautic:campaigns:trigger

Using the command ‘service cron status’ I see that it is running. However the commands still aren’t executed unless I manually type them into the command line (these command work properly when typed in the command line)

These errors are showing in the log:  
There are no errors in the log

Steps I have tried to fix the problem:  
I have tried restructuring the php commands themselves and setting them on different timing but non working. I do properly get the required cronjobs running from terminal, NOT using channel. I am access the Mautic application by running docker exec -it on the container hosting Mautic.

---

<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:** [November 22, 2024, 5:35pm UTC](https://forum.mautic.org/t/mautic-cronjobs/34167/2 "2024-11-22T17:35:06Z")

</div>

Most likely your $PATH is missing/wrong.

Try this:  
`$ which php`

Then, use the output instead of just “php”

i.e.  
if the “which php” cmd returned “/usr/local/bin/php”

current crontab:

```auto
* * * * * php /var/www/html/bin/console mautic:segments:update
* * * * * php /var/www/html/bin/console mautic:campaigns:update
* * * * * php /var/www/html/bin/console mautic:campaigns:trigger

```

New crontab:

```auto
* * * * * /usr/local/bin/php /var/www/html/bin/console mautic:segments:update
* * * * * /usr/local/bin/php /var/www/html/bin/console mautic:campaigns:update
* * * * * /usr/local/bin/php /var/www/html/bin/console mautic:campaigns:trigger

```
