Some hourly cron.php runs exit with no output and return code 14

Nextcloud version (eg, 20.0.5): 27.1.3
Operating system and version (eg, Ubuntu 20.04): FreeBSD 13.2-RELEASE-p4 GENERIC amd64
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4
PHP version (eg, 7.4): 8.2

The issue you are facing:

I’ve set con.php to run once every hour. A couple of times every day, the system reports the following:

php8.2 -f /path/to/cron.php

completed at 2023-10-31 13:15:08 UTC after 15 minutes and produced the
following output:

php8.2 -f /path/to/cron.php exited with no output and return code 14

What does this return code mean?

Where can I find descriptions/explanations of Nextcloud’s return/error codes?

Is this the first time you’ve seen this error? (Y/N):


Steps to replicate it:

See description above.

The output of your Nextcloud log in Admin > Logging:

I don’t see any log entries corresponding to this.

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

$CONFIG = array(
    'instanceid' => '[redacted]',
    'passwordsalt' => '[redacted]',
    'secret' => '[redacted]',
    'trusted_domains' =>
            0 => '',
    'datadirectory' => '/path/to/data',
    'tempdirectory' => '/path/to/temp',
    'log_type' => 'file',
    'logfile' => '/path/to/log',
    'logfilemode' => 432,
    'loglevel' => 2,
    'log.condition' =>
            'apps' =>
                    0 => 'admin_audit',
    'log_rotate_size' => 10485760,
    'debug' => false,
    'dbtype' => 'mysql',
    'version' => '',
    'overwrite.cli.url' => '',
    'htaccess.RewriteBase' => '/base',
    'dbname' => '[redacted]',
    'dbhost' => '[redacted]',
    'dbport' => '[redacted]',
    'dbtableprefix' => '[redacted]',
    'mysql.utf8mb4' => true,
    'dbuser' => '[redacted]',
    'dbpassword' => '[redacted]',
    'installed' => true,
    'mail_smtpmode' => 'sendmail',
    'mail_sendmailmode' => 'smtp',
    'mail_smtpdebug' => false,
    'mail_smtpsecure' => '',
    'mail_smtpauth' => false,
    'mail_smtpauthtype' => 'LOGIN',
    'mail_smtphost' => '',
    'mail_smtpport' => 25,
    'mail_smtptimeout' => 10,
    'trashbin_retention_obligation' => 'auto, 30',
    'twofactor_enforced' => 'true',
    'twofactor_enforced_groups' =>
            0 => '[redacted]',
            1 => '[redacted]',
    'twofactor_enforced_excluded_groups' =>
    'maintenance' => false,
    'has_rebuilt_cache' => true,
    'memcache.local' => '\\OC\\Memcache\\APCu',
    'theme' => '',

The output of your Apache/nginx/system log in /var/log/____:


Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

No corresponding errors in nextcloud.log.

That’s very little. I would really recommend running it at least every 10 minutes.

OK. I can not give you the information about the meaning of that return code in your case but I can help you, how you can find that out.

You can set the loglevel to debug (loglevel 0) in your config/config.php, since most messages about cron-jobs are level 1, information. So that would give you a deeper insight via logfiles.

Then you can see what background jobs are in the queue and when those jobs where last executed with occ:

occ background-job:list -l 100

this will list the first 100 (-l 100) registered background jobs, sorted by job-id.

If you want to get a list, sorted by last_run, you can get it when you query direct from your database. (I’m assuming that you know how to get into the command line client of your database)
If you are using MySQL/MariaDB, the query is:

SELECT id, class, FROM_UNIXTIME(last_run), argument FROM oc_jobs ORDER BY last_run DESC;

and if you are using PostgreSQL, the query must be:

SELECT id, class, TO_TIMESTAMP(last_run), argument FROM oc_jobs ORDER BY last_run DESC;

Then there is the occ command

occ background-job:execute <job_id>

providing the means to carry out each of the tasks individually in order to find out exactly which one is giving out the return code that you couldn’t explain yet.

I hope this helps.

Much luck,