Short answer

DSpace needs a few jobs run on a schedule: sitemaps, the OAI-PMH index, thumbnails and full text (filter-media), the search index, subscription emails, the checksum checker and cleanup. Put them in the dspace user’s crontab with sudo crontab -u dspace -e, never root’s, and none at exactly midnight.

Tested on Ubuntu 26.04 and 24.04, two separate runs. On 24.04, every step is the same. Everything that differed

This lesson starts from a DSpace server set up as in Install DSpace: DSpace in /dspace, run by the dspace user. Every command below is in DSpace 10.1’s own list of commands; jobs from old guides that DSpace 7 removed (such as stats-util) are not.

Step 1: Run each job once by hand

Before you schedule a job, run it once as the dspace user. If it fails here, it would fail every night in silence. On the test server (an empty repository) each one took about 7 seconds, most of it Java starting up.

Sitemaps for search engines

Server
$ time sudo -iu dspace /dspace/bin/dspace generate-sitemaps real	0m6.965suser	0m0.005ssys	0m0.012s
Output hidden (4 lines)

The OAI-PMH index (harvesters such as Google Scholar and BASE)

Server
$ time sudo -iu dspace /dspace/bin/dspace oai importOAI 2.0 manager action startedThere are no indexed documents, using full import.Full importTotal: 0 itemsTotal: 0 itemsOAI 2.0 manager action ended. It took 2 seconds. real	0m7.377suser	0m0.006ssys	0m0.010s
Output hidden (10 lines)

Thumbnails and full text of new files

Server
$ time sudo -iu dspace /dspace/bin/dspace filter-mediaThe script has startedThe script has completed real	0m6.825suser	0m0.001ssys	0m0.014s
Output hidden (6 lines)

The search index

Server
$ time sudo -iu dspace /dspace/bin/dspace index-discoveryThe script has startedUpdating IndexDone with indexingThe script has completed real	0m8.096suser	0m0.004ssys	0m0.013s
Output hidden (8 lines)

Without options it only updates what changed. index-discovery -b rebuilds everything; on a large repository that takes hours, so keep it for repairs, not the nightly job.

Subscription emails

Server
$ time sudo -iu dspace /dspace/bin/dspace subscription-send -f DThe script has startedThe script has completed real	0m6.387suser	0m0.000ssys	0m0.009s
Output hidden (6 lines)

-f D sends the daily emails. They only reach anyone once mail is set up in local.cfg.

The checksum checker and its report

Server
$ time sudo -iu dspace /dspace/bin/dspace checker -lpPruned 0 old results from the database. real	0m6.832suser	0m0.005ssys	0m0.012s
Output hidden (5 lines)
Server
$ sudo -iu dspace /dspace/bin/dspace checker-emailer

checker -lp checks every stored file against the checksum DSpace saved when it was added, in a loop, and prunes old results; checker-emailer mails the result. It printed nothing on the test server, which had no mail set up.

Cleanup

Server
$ time sudo -iu dspace /dspace/bin/dspace cleanupFound 0 deleted bitstream to cleanupCommitting changes to the database... Done! real	0m6.772suser	0m0.002ssys	0m0.015s
Output hidden (6 lines)
Server
$ time sudo -iu dspace /dspace/bin/dspace process-cleanerThe script has startedSearching for processes with status: [COMPLETED]Found 0 processes to be deletedProcess cleanup completedThe script has completed real	0m6.631suser	0m0.006ssys	0m0.012s
Output hidden (9 lines)

cleanup removes files of deleted items from the asset store; process-cleaner removes the records of finished scripts.

Keep Solr in line with the database

Server
$ time sudo -iu dspace /dspace/bin/dspace solr-database-resyncThe script has startedStarting Item resync of Solr and Database...Date range filter used; SolrIndexer.lastIndexed:[* TO 2026-11-20T04:17:47.370Z]The script has completed real	0m6.513suser	0m0.004ssys	0m0.013s
Output hidden (8 lines)

Step 2: The crontab, as the dspace user

Install it for the dspace user, the user DSpace runs as, so the jobs read and write DSpace’s files with the same rights as the services. Times are the server’s local time; none is at exactly midnight, when DSpace starts a new log file. You can paste this whole command, or run sudo crontab -u dspace -e and paste the lines between <<'EOF' and EOF:

Server
$ sudo crontab -u dspace - <<'EOF'# DSpace scheduled jobs (as the dspace user). Times are the server's local time; none at exactly midnight,# when DSpace starts a new log file.MAILTO=""# daily: sitemaps for search engines, OAI-PMH, thumbnails and full text, the search index15 0 * * * /dspace/bin/dspace generate-sitemaps > /dev/null 2>&10 1 * * * /dspace/bin/dspace oai import > /dev/null 2>&10 2 * * * /dspace/bin/dspace filter-media > /dev/null 2>&130 2 * * * /dspace/bin/dspace index-discovery > /dev/null 2>&1# daily: subscription emails (needs mail set up in local.cfg)0 3 * * * /dspace/bin/dspace subscription-send -f D > /dev/null 2>&1# weekly on Sunday: check every file against its checksum, then email the report0 4 * * 0 /dspace/bin/dspace checker -lp > /dev/null 2>&10 6 * * 0 /dspace/bin/dspace checker-emailer > /dev/null 2>&1# weekly on Saturday: remove deleted files from the asset store, old process records0 4 * * 6 /dspace/bin/dspace cleanup > /dev/null 2>&130 4 * * 6 /dspace/bin/dspace process-cleaner > /dev/null 2>&1# monthly: bring the Solr search data back in line with the database0 5 1 * * /dspace/bin/dspace solr-database-resync > /dev/null 2>&1EOF
The dspace user’s crontab
/var/spool/cron/crontabs/dspace
# DSpace scheduled jobs (as the dspace user). Times are the server's local time; none at exactly midnight,# when DSpace starts a new log file.MAILTO=""# daily: sitemaps for search engines, OAI-PMH, thumbnails and full text, the search index15 0 * * * /dspace/bin/dspace generate-sitemaps > /dev/null 2>&10 1 * * * /dspace/bin/dspace oai import > /dev/null 2>&10 2 * * * /dspace/bin/dspace filter-media > /dev/null 2>&130 2 * * * /dspace/bin/dspace index-discovery > /dev/null 2>&1# daily: subscription emails (needs mail set up in local.cfg)0 3 * * * /dspace/bin/dspace subscription-send -f D > /dev/null 2>&1# weekly on Sunday: check every file against its checksum, then email the report0 4 * * 0 /dspace/bin/dspace checker -lp > /dev/null 2>&10 6 * * 0 /dspace/bin/dspace checker-emailer > /dev/null 2>&1# weekly on Saturday: remove deleted files from the asset store, old process records0 4 * * 6 /dspace/bin/dspace cleanup > /dev/null 2>&130 4 * * 6 /dspace/bin/dspace process-cleaner > /dev/null 2>&1# monthly: bring the Solr search data back in line with the database0 5 1 * * /dspace/bin/dspace solr-database-resync > /dev/null 2>&1

Read back from the test server (Ubuntu 26.04) on 2026-11-20, after the steps had worked; Read back with `sudo crontab -u dspace -l`.. Placeholders such as [password]: type your own value in the box above the file to fill them in, or replace them yourself.

Read it back to check every line arrived:

Server
$ sudo crontab -u dspace -l# DSpace scheduled jobs (as the dspace user). Times are the server's local time; none at exactly midnight,# when DSpace starts a new log file.MAILTO=""# daily: sitemaps for search engines, OAI-PMH, thumbnails and full text, the search index15 0 * * * /dspace/bin/dspace generate-sitemaps > /dev/null 2>&10 1 * * * /dspace/bin/dspace oai import > /dev/null 2>&10 2 * * * /dspace/bin/dspace filter-media > /dev/null 2>&130 2 * * * /dspace/bin/dspace index-discovery > /dev/null 2>&1# daily: subscription emails (needs mail set up in local.cfg)0 3 * * * /dspace/bin/dspace subscription-send -f D > /dev/null 2>&1# weekly on Sunday: check every file against its checksum, then email the report0 4 * * 0 /dspace/bin/dspace checker -lp > /dev/null 2>&10 6 * * 0 /dspace/bin/dspace checker-emailer > /dev/null 2>&1# weekly on Saturday: remove deleted files from the asset store, old process records0 4 * * 6 /dspace/bin/dspace cleanup > /dev/null 2>&130 4 * * 6 /dspace/bin/dspace process-cleaner > /dev/null 2>&1# monthly: bring the Solr search data back in line with the database0 5 1 * * /dspace/bin/dspace solr-database-resync > /dev/null 2>&1
Output hidden (18 lines)

Step 3: Check that cron really runs DSpace

The nightly times would make you wait a day. Instead, add a test line that runs every minute and writes dspace version to a file. It proves that cron starts DSpace as the dspace user, with cron’s own short PATH:

Server
$ systemctl is-active cronactive
Output hidden (1 line)
Server
$ (sudo crontab -u dspace -l; echo '* * * * * /dspace/bin/dspace version > /tmp/cron-test.txt 2>&1') | sudo crontab -u dspace -

After a minute:

Server
$ cat /tmp/cron-test.txtDSpace version:  10.1  SCM revision:  UNKNOWN_REVISION    SCM branch:  UNKNOWN_BRANCH            OS:  Linux(amd64) version 7.0.0-29-generic  Applications:     Discovery:  enabled.           JRE:  Ubuntu version 21.0.13.1   Ant version:  Apache Ant(TM) version 1.10.15 compiled on January 13 2026 Maven version:  3.9.12   DSpace home:  /dspace
Output hidden (10 lines)

Cron’s log names the user and the command it started:

Server
$ sudo journalctl -u cron --no-pager -n 50 | grep -m 2 '(dspace) CMD'Nov 20 04:29:01 web-server CRON[20642]: (dspace) CMD (/dspace/bin/dspace version > /tmp/cron-test.txt 2>&1)
Output hidden (1 line)

Now remove the test line again; the count of matching lines must be 0:

Server
$ sudo crontab -u dspace -l | grep -v 'cron-test.txt' | sudo crontab -u dspace - && sudo rm -f /tmp/cron-test.txtsudo crontab -u dspace -l | grep -c 'cron-test'0
Output hidden (1 line)

Troubleshooting

  • A job seems not to run: run its command by hand as the dspace user to see its error, then check cron’s log for its (dspace) CMD line. Details.
  • Old guides list stats-util or dspace stats-… jobs: those are for DSpace 6 and earlier; DSpace 7 and later keep statistics in Solr and do not ship them.

What these steps changed on the server

Both runs recorded the server before the first step and after the last (see the Tested on box below): the dspace user’s crontab, plus what the jobs wrote (sitemaps, the OAI and search indexes, logs). No package and no service changed.

Ubuntu 26.04 vs 24.04

The same check ran on a fresh 26.04 server and on a fresh 24.04 server, each with its own run log. Every job printed the same on both; only the versions in the table differ.

WhatUbuntu 26.04Ubuntu 24.04
SystemUbuntu 26.04 LTS7.0.0-29-genericUbuntu 24.04.4 LTS6.8.0-137-generic
openjdk-21-jdk-headless21.0.13.1+2-1~26.04.121.0.13.1+2-1~24.04.1
maven3.9.12-1not installed
ant1.10.15-1build11.10.14-1
postgresql-1717.12-1.pgdg26.04+1not installed
cron3.0pl1-200ubuntu13.0pl1-184ubuntu2
dspace10.110.1
solr9.11.09.11.0
postgresql-16not installed16.15-0ubuntu0.24.04.1
Commands and resultsThe same on every release: the same commands, the same results.
ProofRun log, 36 checks passedRun log, 36 checks passed