Mautic Community Forums

Cron settings (issue with server)

Hi guys,

I like Mautic. All is great but I have big issue with cron settings.

I do not know where to insert that command. My servers do not have cPanel.



I am used to run crons by url that is simple just insert set time and it runs. But Mautic has those mautic:campaigns:update where I can insert those parameters? Everywhere is just field for url and nothing else. If I run basic (ex. email.mydomain.com/app/console) it does nothing.



Can anybody help me with it?

I have tried to run it as file_get_contents, used external services like easycron.com but nothing trigger or update my mautic stats.

File structure of php file that I can run by cron url (ex. mydomain.com/update_mautic.php) or anything what can help me.



I am in touch with server provider, other programmers but nobody knows. Can you help me?

Hi guys,
I like Mautic. All is great but I have big issue with cron settings.
I do not know where to insert that command. My servers do not have cPanel.

I am used to run crons by url that is simple just insert set time and it runs. But Mautic has those mautic:campaigns:update where I can insert those parameters? Everywhere is just field for url and nothing else. If I run basic (ex. email.mydomain.com/app/console) it does nothing.

Can anybody help me with it?
I have tried to run it as file_get_contents, used external services like easycron.com but nothing trigger or update my mautic stats.
File structure of php file that I can run by cron url (ex. mydomain.com/update_mautic.php) or anything what can help me.

I am in touch with server provider, other programmers but nobody knows. Can you help me?

For most cron jobs, you would use the full path to your Mautic install to run the cronjob. Something like this (which is a raw cronjob):

*/5 * * * * php /home/myuser/public_html/mautic/app/console mautic:leadlists:update -e prod

If you don’t know the full path to your web root, you may be able to use ~/public_html instead if you are using a Linux host.

If your server doesn’t support running PHP commands directly from cron, then you can try to create a several PHP scripts that are web accessible with something like the following:

<?php
require_once __DIR__.'/app/bootstrap.php.cache';
require_once __DIR__.'/app/AppKernel.php';

use SymfonyBundleFrameworkBundleConsoleApplication;
use SymfonyComponentConsoleInputArgvInput;
use SymfonyComponentConsoleOutputBufferedOutput;

try {
    $args   = array('console', 'mautic:leadlists:update', '--env=prod', '--no-debug');
    $input  = new ArgvInput($args);
    $output = new BufferedOutput();

    $kernel      = new AppKernel('prod', false);
    $application = new Application($kernel);
    $application->setAutoExit(false);
    $result = $application->run($input, $output);

    echo "<pre>n".$output->fetch().'</pre>';
} catch (Exception $exception) {
    echo $exception->getMessage();
}

Create one per command and change the specific command in $args = array('console', 'mautic:leadlists:update', '--env=prod', '--no-debug'); (replace ‘mautic:leadlists:update’ with the command needed). Note that using a web script may hit PHP time limits which may cause issues for large lists.

Cool, thank you. It looks that it works.
This should definitely be somewhere in tutorial for people like me.