# Cron Job Set Up Problem

**URL:** https://forum.mautic.org/t/cron-job-set-up-problem/2065
**Category:** Product Support
**Created:** [July 20, 2015, 7:36am UTC](https://forum.mautic.org/t/cron-job-set-up-problem/2065 "2015-07-20T07:36:44Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![monclarthunder](https://avatars.discourse-cdn.com/v4/letter/m/c0e974/32.png) [@monclarthunder](https://forum.mautic.org/u/monclarthunder)
#### Post date: [July 20, 2015, 7:36am UTC](https://forum.mautic.org/t/cron-job-set-up-problem/2065/1 "2015-07-20T07:36:44Z")

</div>

I am trying to set up cron jobs in cpanel using a hosted Godaddy account.  
  
  
  
I put in the following script: _/usr/local/bin/php -f /home/my username/public\_html/mautic/app/console mautic:campaign:trigger -e prod_  
  
  
  
I get the following response: _Script in progress. Use -f or --force to force execution._  
  
  
  
I let the cron job run for about an hour and I get the same response.  
  
  
  
The scripts for the 2 other cron jobs seem to work fine.

---

<div class="post-metadata">

### Author: ![ChrisMorley](https://avatars.discourse-cdn.com/v4/letter/c/9fc348/32.png) [@ChrisMorley](https://forum.mautic.org/u/ChrisMorley)
#### Post date: [July 20, 2015, 7:38pm UTC](https://forum.mautic.org/t/cron-job-set-up-problem/2065/2 "2015-07-20T19:38:12Z")

</div>

I’m on GoDaddy too and am having a heck of a time trying to get the cron job to run - could you tell me what script you ended up using that worked?

---

<div class="post-metadata">

### Author: ![monclarthunder](https://avatars.discourse-cdn.com/v4/letter/m/c0e974/32.png) [@monclarthunder](https://forum.mautic.org/u/monclarthunder)
#### Post date: [July 20, 2015, 7:36am UTC](https://forum.mautic.org/t/cron-job-set-up-problem/2065/3 "2015-07-20T07:36:44Z")

</div>

I am trying to set up cron jobs in cpanel using a hosted Godaddy account.

I put in the following script: /usr/local/bin/php -f /home/my username/public\_html/mautic/app/console mautic:campaign:trigger -e prod

I get the following response: Script in progress. Use -f or --force to force execution.

I let the cron job run for about an hour and I get the same response.

The scripts for the 2 other cron jobs seem to work fine.

---

<div class="post-metadata">

### Author: ![monclarthunder](https://avatars.discourse-cdn.com/v4/letter/m/c0e974/32.png) [@monclarthunder](https://forum.mautic.org/u/monclarthunder)
#### Post date: [July 20, 2015, 11:26am UTC](https://forum.mautic.org/t/cron-job-set-up-problem/2065/4 "2015-07-20T11:26:35Z")

</div>

I think I have resolved the cron jobs problem.

---

<div class="post-metadata">

### Author: ![menolo](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@menolo](https://forum.mautic.org/u/menolo)
#### Post date: [September 24, 2015, 10:35am UTC](https://forum.mautic.org/t/cron-job-set-up-problem/2065/5 "2015-09-24T10:35:59Z")

</div>

> [@2106:@monclarthunder](#):
>
> I think I have resolved the cron jobs problem.

How did you solve this? I’m running into the same thing.

---

<div class="post-metadata">

### Author: ![Sokoban](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@Sokoban](https://forum.mautic.org/u/Sokoban)
#### Post date: [September 29, 2015, 5:23pm UTC](https://forum.mautic.org/t/cron-job-set-up-problem/2065/6 "2015-09-29T17:23:14Z")

</div>

@menolo , for cron jobs cpanel issue there’s another way to fix it. Follow these steps:

1- Login your cPanel and open File Manager.  
2- Create new file into Mautic’s folder named cronjob.php (or any one of your choice).  
3- Copy this script and paste into cronjob.php. Then replace ILoveMAUTIC by any of your choice. Save and close.  
\<?php

```
if (!isset($_GET['ILoveMAUTIC'])) {
echo 'The secret phrase is wrong.';
die;
}

$link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$allowedTasks = array(
'cache:clear',
'mautic:leadlists:update',
'mautic:campaigns:update',
'mautic:campaigns:trigger',
'mautic:email:process',
'mautic:fetch:email',
'doctrine:migrations:migrate',
'doctrine:schema:update --dump-sql',
'doctrine:schema:update --force'
);

if (!isset($_GET['task'])) {
echo 'Specify what task to run. You can run these:';
foreach ($allowedTasks as $task) {
$href = $link . '&task=' . urlencode($task);
echo '<br><a href="' . $href . '">' . $href . '</a>';
}
echo '<br><a href="https://www.mautic.org/docs/setup/index.html">Read more</a>';
echo '<br><b style="color:red">Please, backup your database before executing the doctrine commands!</b>';
die;
}

$task = urldecode($_GET['task']);

if (!in_array($task, $allowedTasks)) {
echo 'Task ' . $task . ' is not allowed.';
die;
}

$fullCommand = explode(' ', $task);
$command = $fullCommand[0];

$argsCount = count($fullCommand) - 1;
$args = array('console', $command);

if ($argsCount) {
for ($i = 1; $i <= $argsCount; $i++) {
$args[] = $fullCommand[$i];
}
}

require_once __DIR__.'/app/bootstrap.php.cache';
require_once __DIR__.'/app/AppKernel.php';
use SymfonyBundleFrameworkBundleConsoleApplication;
use SymfonyComponentConsoleInputArgvInput;
use SymfonyComponentConsoleOutputBufferedOutput;

defined('IN_MAUTIC_CONSOLE') or define('IN_MAUTIC_CONSOLE', 1);

try {
$input = new ArgvInput($args);
$output = new BufferedOutput();
$kernel = new AppKernel('prod', false);
$app = new Application($kernel);
$app->setAutoExit(false);
$result = $app->run($input, $output);
echo "<pre>n".$output->fetch().'</pre>';
} catch (Exception $exception) {
echo $exception->getMessage();
}

```

4- Type into browser: [domain.com/mautic/cronjob.php?ILoveMAUTIC](http://domain.com/mautic/cronjob.php?ILoveMAUTIC) replacing whatever needed. Assuming /mautic/ installation folder. It will be displayed many options to click. It’s a manual cron job for while. Keep this tab open.  
5- Sign up here: [https://cron-job.org/](https://cron-job.org/) .It’s free up to 60 cron jobs but you’ll need upto 4 cron jobs.  
6- Include new URLs from tab at step 4.  
[domain.com/mautic/cronjob.php?&task=mautic%3Aleadlists%3Aupdate](http://domain.com/mautic/cronjob.php?&task=mautic%3Aleadlists%3Aupdate)  
[domain.com/mautic/cronjob.php?&task=mautic\<ampaigns%3Aupdate](http://domain.com/mautic/cronjob.php?&task=mautic%3campaigns%3Aupdate)  
[domain.com/mautic/cronjob.php?&task=mautic\<ampaigns%3Atrigger](http://domain.com/mautic/cronjob.php?&task=mautic%3campaigns%3Atrigger)  
[domain.com/mautic/cronjob.php?&task=mautic\>mail%3Aprocess](http://domain.com/mautic/cronjob.php?&task=mautic%3email%3Aprocess) - This one just for using queue email.

I’ve tested and it works fine!  
Thx to @escopecz and @ninjoan

---

<div class="post-metadata">

### Author: ![Agnon](https://avatars.discourse-cdn.com/v4/letter/a/d78d45/32.png) [@Agnon](https://forum.mautic.org/u/Agnon)
#### Post date: [October 13, 2015, 6:42am UTC](https://forum.mautic.org/t/cron-job-set-up-problem/2065/7 "2015-10-13T06:42:21Z")

</div>

There is another easy-to-use cron job service that may help: [https://www.easycron.com](https://www.easycron.com).

---

<div class="post-metadata">

### Author: ![jantheofel](https://avatars.discourse-cdn.com/v4/letter/j/e47c2d/32.png) [@jantheofel](https://forum.mautic.org/u/jantheofel)
#### Post date: [June 17, 2016, 7:43pm UTC](https://forum.mautic.org/t/cron-job-set-up-problem/2065/8 "2016-06-17T19:43:12Z")

</div>

@Sokoban I had problems with your script when multiple cronjobs were running at the same time. Here is my solution:  
[https://www.mautic.org/community/index.php/4395-why-17-minutes-delay](https://www.mautic.org/community/index.php/4395-why-17-minutes-delay)

---

<div class="post-metadata">

### Author: ![sasivarnakumar](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@sasivarnakumar](https://forum.mautic.org/u/sasivarnakumar)
#### Post date: [February 20, 2016, 6:08am UTC](https://forum.mautic.org/t/cron-job-set-up-problem/2065/9 "2016-02-20T06:08:42Z")

</div>

I m in a cpanel without shell access ☹  
Your cronjob script Saved my day. I was able to see the error and fix it. Thank you @Sokoban

---

<div class="post-metadata">

### Author: ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)
#### Post date: [February 2, 2020, 10:57pm UTC](https://forum.mautic.org/t/cron-job-set-up-problem/2065/10 "2020-02-02T22:57:46Z")

</div>


