Search code examples
cronmautic

Doesn't run this commands on mautic cron job


Hi guys i have the next problem(sorry for my english):

I want to executate a command in Mautic cron job, i put the next comands:

*/1 * * * * /usr/local/bin/php /apps/mautic/htdocs/app/console mautic:segments:update

*/1 * * * * /usr/local/bin/php /apps/mautic/htdocs/app/console mautic:campaigns:update

*/1 * * * * /usr/local/bin/php /apps/mautic/htdocs/app/console mautic:campaigns:trigger

I try a lot of things but no one of them work, like:

*/1 * * * *  root /usr/local/bin/php /apps/mautic/htdocs/app/console  mautic:segments:update

or

*/1 * * * * bitnami php /apps/mautic/htdocs/app/console  mautic:segments:update

But i don't know what fail's,if it's the user name,the route to php,the comand,if they doesn't have permission...

If i put this manually work perfectly

php /apps/mautic/htdocs/app/console  mautic:segments:update

ty so much


Solution

  • You should check whether the path of the php program correct. You can check the the full path of the php program in terminal output by this command:

    which php
    

    To create a cron job, should always use the full path of the program. The crontab default environment is not like the logged in user. The program may not be found if the path is not defined to the crontab environment.

    The crontab syntax composed of two parts, datetime to execute & command to be executed. User is not required to add before the command.

    *     *     *   *    *        command to be executed
    -     -     -   -    -
    |     |     |   |    |
    |     |     |   |    +----- day of week (0 - 6) (Sunday=0)
    |     |     |   +------- month (1 - 12)
    |     |     +--------- day of        month (1 - 31)
    |     +----------- hour (0 - 23)
    +------------- min (0 - 59)