Scheduled Jobs not running automatically

I am currently on version 8.0.0. I enabled CRON jobs in the module setup and can see the default “Scheduled Jobs” in the Admin Tools section. I created a new job and ran it manually. Everything worked as expected. However, when I set it to run every 1 minute (as a test), it did not run. I checked all the settings but it will not run automatically. Is there something else I need to enable so this can run automatically?

Hi,

Did you ask the system where is installed dolibarr to run the task every minute ?
Dependind on where it is installed, there is external to dolibarr setting to be made.

I’m not sure what you mean when you ask “did you ask the system”. Can you clarify? I set up the job to run every minute and it never runs. I checked all the values and they appear to make sense. If I click the link to run now, it works. It does seem to be that the CRON service is not running. You mention the external setting. What would that setting be and where woudl I make it?

Hi,

Dolibarr will not run by it self the task.
The system where Dolibarr is installed needs to call each minute the Dolibarr script to launch that.

This will depend on where and how your Dolibarr is installed.

1 Like

Ok, I think I understand. You’re telling me I need to have my web server call the CRON job once a minute because it doesn’t automatically run itself. I guess I was mislead because it allows me to change the setting from running once a minute to once an hour or once a day. Question. If I set the job in Dolibarr to run once a day and I set the server (system) to run the query once a minute, will it execute once a minute or will it be smart enough to only run once a day?

On the parameters you have the code to be put on the crontab on your serveur

Even if you call the cron script each minute, if you set every hour it will be executed only once per hour.

1 Like

Ok, that makes sense now. I have everything set up, I just need to add the crontab entry to run every 5 mintes. Thanks!

1 Like

thanks for the help everyone. For me however the only available folder is the public/cron/cron_run_jobs.php but not the scripts/cron/cron_run_jobs.php.

The result is that the url seems to work, but running the php script doesn’t. it returns:

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.

As I said. No scripts/cron directory in sight. Am I missing something?

1 Like

Hi how can I use parameter in cronjob in windows?

1 Like

root@crm:/home/user# /var/www/dolibarr/scripts/cron/cron_run_jobs.php ZWacz5158axxcAAH7x6pFQNDfV0M093e admin
PHP Fatal error: Uncaught Error: Class “mysqli” not found in /var/www/dolibarr/htdocs/core/db/mysqli.class.php:239
Stack trace:
#0 /var/www/dolibarr/htdocs/core/db/mysqli.class.php(93): DoliDBMysqli->connect()
#1 /var/www/dolibarr/htdocs/core/lib/functions.lib.php(159): DoliDBMysqli->__construct()
#2 /var/www/dolibarr/htdocs/master.inc.php(140): getDoliDBInstance()
#3 /var/www/dolibarr/scripts/cron/cron_run_jobs.php(62): require_once(‘…’)
#4 {main}
thrown in /var/www/dolibarr/htdocs/core/db/mysqli.class.php on line 239

Hello,

PHP CLI doesn’t have MySQL extension in your setup

Can you give some more details? What should I do?

root@crm:/usr/lib/php/20210902# /var/www/dolibarr/scripts/cron/cron_run_jobs.php --force VqUDwX8oHkF94L28knqt4tN6XWgq646T admin
PHP Warning: PHP Startup: Unable to load dynamic library ‘mysqli’ (tried: /usr/lib/php/20210902/mysqli (/usr/lib/php/20210902/mysqli: cannot open shared object file: No such file or directory), /usr/lib/php/20210902/mysqli.so (/usr/lib/php/20210902/mysqli.so: undefined symbol: mysqlnd_global_stats)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘pdo_mysql’ (tried: /usr/lib/php/20210902/pdo_mysql (/usr/lib/php/20210902/pdo_mysql: cannot open shared object file: No such file or directory), /usr/lib/php/20210902/pdo_mysql.so (/usr/lib/php/20210902/pdo_mysql.so: undefined symbol: pdo_parse_params)) in Unknown on line 0
***** cron_run_jobs.php (17.0.2) pid=520044 - userlogin=VqUDwX8oHkF94L28knqt4tN6XWgq646T - 2023-08-05T21:32:39Z *****