sample files

time

timedatectl set-timezone Etc/UTC

reload services

systemctl daemon-reload

ENV

Environment="ONE=one" 'TWO=two two'
EnvironmentFile=/etc/default/service

User

[Service]
User=tobias # run as specific user

Run commands in systemd context

systemd-run bash -c "while true; do date; sleep 10; done"

Timers

enable

systemctl enable journal-backup.timer
systemctl start journal-backup.timer

display Timer Status

systemctl list-timers journal-backup.timer

re-enable timer

systemctl reenable --now journal-backup.timer

patterns

name pattern
every 15 seconds OnCalendar=::0/15
every 10 minutes OnCalendar=*:0/10:0

example

#/etc/systemd/system/journal-backup.service
[Unit]
Description=Backup journalctl

[Service]
ExecStart=/home/tobias/bin/ts-journal


#/etc/systemd/system/journal-backup.timer
[Unit]
Description=Journal Backup Service

[Timer]
OnCalendar=*:0/5:0 # every 5 minutes

[Install]
WantedBy=timers.target