Search code examples
rhelsystemdsystemctl

systemctl failing with unknown section 'Timer'


I have a systemctl job that performs vertica backup to s3, i wanted to add a timer that runs everyday at 3am . I tried to create an override file with the timer section but when i do daemon-reload, I am getting an error `Unknown section Timer', I am unable to find the issue.

/etc/systemd/system/vertica-backup.service.d/Override.conf

[Timer]
OnCalendar=*-*-* 03:00:00
Unit=vertica-backup.service

/etc/systemd/system/vertica-backup.service:

[Unit]
Description = Vertica Backup Service
After = network.target

[Service]
User= dbadmin
ExecStart= /usr/local/bin/vertica-backup.sh

Error

May 15 15:19:47 ip-10-150-4-42.ec2.internal systemd[1]: [/etc/systemd/system/vertica-backup.service.d/override.conf:1] Unknown section 'Timer'. Ignoring.
May 15 15:19:50 ip-10-150-4-42.ec2.internal systemd[1]: [/etc/systemd/system/vertica-backup.service.d/override.conf:1] Unknown section 'Timer'. Ignoring.

Solution

  • [Timer] sections don't go in service files, they go in their own .timer files. Create /etc/systemd/system/vertica-backup.timer and put the [Timer] section in there.

    See man systemd.timer for reference.