Sometimes I just want to make a quick cronjob. And with SysV, this was a cinch! But now with systemd, I have to make a timer file, a service file, and run a few systemctl commands.

Service and Timer file

To do so you have to create a service and a timer file.

The service file will contain the command and any needed things, like the user to run it under. Give it whatever name you want to, and you can use these templates:


Description=The Description of what your Cronjob does
# run as this user
# User=username

ExecStart=/path/to/executable -o "your option here" --any-thing-else


Description=The Description of what your Cronjob does

# on boot

# How often to run it

# If the machine is not on during the set time, run asap
# Persistent=true

# Set a random delay before running 
# so multiple cronjobs do not run at once.


You install these (as a custom cronjob) in `/etc/systemctl/system

Then reload systemd and load the cronjob:

systemctl daemon-reload
systemctl enable name-of-your-cron-script.timer
systemctl start name-of-your-cron-script.timer

To list the current active and inactive cronjobs and their timers:

systemctl list-timers --all 

Using crontab with Systemd-cron-next

To get the old functionality of the crontab, and the cron.hourly, cron.daily, and other cron folders, you can use Systemd-cron and Systemd-cron-next. You only need one or the other.

All the package does is take your crontab and the hourly, daily, weekly, yearly, onboot files, and it will create your .timer and .service files for you. And it supports emailing errors so you can get notified if a cron fails.


Arch wiki page on systemd timers