Systemd Timer Units as alternative to cronjob?


I’m having some trouble to make my cronjob run as you can see here.

Somebody suggested to use systemd timer units instead.
Is that a possibility or is it by any circumstances mandatory to run cron with one of the three given options?

Thanks for the replies!

Best regards

I managed to make the cronjob work, but I still would like to know if it also can be done with systemd and why there are only those three options (AJAX, Web, cron)?

Best regards

Hey proton,

works fine here.

First create a systemd service file: nextcloud-cron.service

# Execute nextcloud cron every 15 minutes.

ExecStart=/bin/bash -c php -f /srv/http/nextcloud/cron.php

Next create timer for this service: nextcloud-cron.timer

# Calls Nextcloud cron every 15 Minutes.



Don’t forget to adjust your nextcloud User= and path in the ExecStart Statement of the service file.

Copy both files in the /etc/systemd/system directory and activate the timer. - Done.

Happy new year angerm! :slight_smile:

Thank you very much for this detailed explanation! :smiley:

Best regards


Could you please explain the advantage of systemd over cron? Is it suggested to rather use systemd?



in which case I think you can use the service of your choice. They both do a good job here.

However, if the service is to be monitored in the sense of a daemon, systemd has advantages here:

systemd starts the service and also monitors whether it is still running. If desired, systemd can also restart the service automatically after a crash.
Dependencies at system startup are detected and, if necessary, the start of a service is written to a pipe until the calling service is ready. This speeds up the start enormously, because almost everything can be started in parallel. Everything is logged in the log.

With a little practice, service and timer units are quickly created and very flexible.

In almost all distributions, systemd is now standard. Therefore, a systemd service can be run on many installations without additional dependencies.

It is just a new and almost everywhere available method to start the system and services on Linux machines.

greetings …