Create a systemd timer

Daily timer that replaces cron; Persistent=true runs missed jobs after downtime

cat > /etc/systemd/system/backup.timer <<EOF [Unit] Description=Daily backup [Timer] OnCalendar=daily Persistent=true [Install] WantedBy=timers.target EOF

tool
systemd26 commands
tags
systemd

More systemd commands

  • systemctl set-property myapp.service MemoryMax=512M CPUQuota=50%

    Set cgroup limits without editing the unit file

  • systemctl status myapp.service | grep -E 'Memory:|CPU:|Tasks:'

    Current memory, CPU time and task count from the cgroup

  • systemctl list-units --type=socket --all

    Show all socket units and their state, including inactive ones

  • systemctl mask snapd.service

    Stop a service from being started by anything, even as a dependency

  • systemctl show myapp.service -p Environment

    Print the environment variables set for the service

all 26 systemd commands