I’m trying to add a periodic systemd service to a debian 10 machine. Basically I want it to clean up a database once a week. The service file, which I can confirm works when I run:
# systemctl start cleanup-service
Which is:
[Unit]
Description=Remove old entries from database
Requires=mysql.service
After=mysql.service
OnFailure=unit-status-mail@%n.service
[Service]
Type=oneshot
EnvironmentFile=/etc/environment
ExecStart=<some command>
The timer, which I copied from another, functioning timer is
[Unit]
Description=Run cleanup-service periodically
[Timer]
OnCalendar=*-*-* 14:08:00
[Install]
WantedBy=timers.target
However, when I run:
# systemctl enable cleanup-service.timer
$ systemctl --all
The relevant line reads :
backup-service.timer loaded active waiting Run backup-service service periodically
cleanup-service.timer loaded inactive dead Run cleanup-service service periodically
I have no idea how to diagnose this. All of the permissions are the same. It’s possible that the server needs a reboot but that would have to be done at another time. Outside of a reboot I have no idea what else to try.
Is there some subtlety of systemd that I’m missing here?