brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: occ background-job:history -s 3 shows which Nextcloud background jobs crashed

Nextcloud
~/tips/tip-nextcloud-occ-background-job-history

sudo -E -u www-data php occ background-job:history -s 3 -l 10

Filters the history of background jobs by status, so crashed and failed jobs stand out.

When something in Nextcloud seems stuck, the history of the background jobs is a good first place to look, and occ can print it.

sudo -E -u www-data php occ background-job:history -s 3 -l 10

The command shows past jobs with run id, status, class, start time, server id, PID, duration and memory use. The -s option filters by status: 0 is running, 1 succeeded, 2 failed and 3 crashed. You can repeat it, so -s 2 -s 3 gives you failed and crashed jobs together. -l limits the number of rows (the default is 200) and -c filters on a job class.

The docs show an example where a job of the class OCA\Text\Cron\Cleanup has the status Crashed with a duration of about ten minutes. That is what you are looking for: a job that keeps dying, or one that runs far longer than the rest.

To see what is running right now, use occ background-job:running. To run one job by hand, occ background-job:execute 42 takes the job id from occ background-job:list.

The caveat: the history tells you that a job crashed, not why. For the cause, go to the Nextcloud log, which occ log:watch can follow live.

Further reading: Nextcloud admin manual: system and maintenance commands

Going deeper: Guide: put Nextcloud behind Nginx Proxy Manager with HTTPS and the right headers

More Nextcloud tips sudo -E -u www-data php occ user:report sudo -E -u www-data php occ app:update --showonly docker exec --user www-data nextcloud php occ maintenance:mode --on docker exec -it --user www-data nextcloud php occ user:resetpassword layla docker exec -it --user www-data nextcloud php occ log:watch All Nextcloud tips (13) All topics

Link