Scheduled jobs not running on Dolibarr 12.0.3

I enabled Local Database Backup which is a built in scheduled job in Dolibarr 12.0.3 which is disabled at the time of installation. I am manually able to click run and the job successfully runs and saves an SQL dump.
However, when it is scheduled to run,
I get [09/Nov/2020:15:07:13 +0300] “-” 408 - in apache server log whenever a scheduled job is triggered.
How can this be solved?

1 Like

Please see the screenshot. Notice the icons after scheduled time is triggered.

Hi,

How do you launch the schedule job script ? by cron ?

1 Like


It is the default settings. I did not change anything. Schedule job script.

Hi,

This is not what I ment.

The schedule job module need to be externally activated every 5 minutes to work.
Have you done this step ?

1 Like


I’m afraid I haven’t done that.

If you do not do it, scheduled jobs are never executed.

2 Likes

But my settings are similar to yours right?

Also it says on Unix environment we need to run it every 5 mins
I use windows.

This is my result on trying the second link.

cron_run_jobs.php cronjobid: 6 priority=90 entity=0 label=MakeLocalDatabaseDumpShort -> we change entity so we reload user and conf - qualified - result of run_jobs = 1 - reprogrammed Result: 1 jobs - 1 launched = 1 OK + 0 KO

Yes this is working.

But you need to have an external tool that launch the script every 5 minutes.

1 Like

I believe you are referring to this -

Command line to check and launch qualified cron jobs:
…/scripts/cron/cron_run_jobs.php bT492eaMO8RnN20X1nJ0w2pW5YubQvHn sachin [cronjobid]

Note: On Microsoft™ Windows environment you can use Scheduled Task tools to run the command line each 5 minutes

Which php file should I call every 5 mins?
I found one cron_run_jobs.php in Apache24\htdocs\dolibarr\public\cron

When I tried to run that, I got
“PS C:\php> .\php.exe -f C:\Apache24\htdocs\dolibarr\public\cron\cron_run_jobs.php
Error: This page can’t be used as a CLI script. For the CLI version of script, launch cron_run_job.php available into scripts/cron/ directory.”

But I am not able to find any other cron_run.php file.

Hi,

/scripts/cron/cron_run_jobs.php

Can be download from here : https://github.com/Dolibarr/dolibarr/blob/develop/scripts/cron/cron_run_jobs.php

In your setup you are supposed to have :
C:\Apache24\htdocs\dolibarr
C:\Apache24\htdocs\script

1 Like

What did you mean by

In your setup you are supposed to have :
C:\Apache24\htdocs\dolibarr
C:\Apache24\htdocs\script

Do I have to include these in cron_run_jobs.php?
What values should I give for?
require_once $path.“…/…/htdocs/master.inc.php”;
require_once DOL_DOCUMENT_ROOT.“/cron/class/cronjob.class.php”;
require_once DOL_DOCUMENT_ROOT.‘/user/class/user.class.php’;

Because, I am getting the following error while I try to run the script.

C:\php>php C:\Apache24\htdocs\dolibarr\scripts\cron\cron_run_jobs.php bT492eaMO8RnN20X1nJ0w2pW5YubQvHn sachin 1
PHP Warning: require_once(C:\Apache24\htdocs\dolibarr\scripts\cron/…/…/htdocs/master.inc.php): failed to open stream: No such file or directory in C:\Apache24\htdocs\dolibarr\scripts\cron\cron_run_jobs.php on line 45
PHP Fatal error: require_once(): Failed opening required ‘C:\Apache24\htdocs\dolibarr\scripts\cron/…/…/htdocs/master.inc.php’ (include_path=‘.;C:\php\pear’) in C:\Apache24\htdocs\dolibarr\scripts\cron\cron_run_jobs.php on line 45

I even tried updating paths in cron_run_jobs.php
require_once $path.“C:\Apache24\htdocs\dolibarr\master.inc.php”;
require_once DOL_DOCUMENT_ROOT.“C:\Apache24\htdocs\dolibarr\cron\class\cronjob.class.php”;
require_once DOL_DOCUMENT_ROOT.‘C:\Apache24\htdocs\dolibarr\user\class\user.class.php’;

These are the correct directories where required files exist. Still it’s the same error

It was taking additional path names from $path and DOL_DOCUMENT_ROOT
That is why it was not able to access required files! :sweat_smile:
I removed those and it an fine.
Thank you so much for your help. :raised_hands:

Hi,

YOu have a non standard Dolibarr installation.
You should adapt this line:

Should become

require_once $path.“…/…/dolibarr/master.inc.php”;

2 Likes

My installation was in windows, so I gave the appropriate paths and it worked.
Thanks ksar.

Blockquote
require_once “C:\Apache24\htdocs\dolibarr\master.inc.php”;
require_once “C:\Apache24\htdocs\dolibarr\cron\class\cronjob.class.php”;
require_once ‘C:\Apache24\htdocs\dolibarr\user\class\user.class.php’;

Modification of the first line is enough.

the master.inc.php define the DOL_DOCUMENT_ROOT variable.

1 Like

Now it is saying, cron_run_jobs.php cronjobid: 2 priority=50 entity=0 label=PurgeDeleteTemporaryFilesShort -> we change entity so we reload user and conf - not qualified Result: 1 jobs - 0 launched = 0 OK + 0 KO