There is some confusion on setting up my certbot auto renew.
I’m using Ubuntu 18.10 with systemd.
Under /lib/systemd/system there is a certbot.service file already created.
If I run sudo systemctl enable certbot.service it fails to put certbot.serivce in /etc/systemd/system, and there is no default certbot.service file there.
------- The Error
:/etc/systemd/system$ sudo systemctl enable certbot.service
The unit files have no installation config (WantedBy, RequiredBy, Also, Alias
settings in the [Install] section, and DefaultInstance for template units).
This means they are not meant to be enabled using systemctl.
Possible reasons for having this kind of units are:
- A unit may be statically enabled by being symlinked from another unit’s
.wants/ or .requires/ directory.
- A unit’s purpose may be to act as a helper for some other unit which has
a requirement dependency on it.
- A unit may be started when needed via activation (socket, path, timer,
D-Bus, udev, scripted systemctl call, …).
- In case of template units, the unit is meant to be enabled with some
instance name specified.
I do have /etc/systemd/system/timers.target.wants/certbot.timer file, and when I do a systemctl status it shows the timer is running.
So first do I need to move the /lib/systemd/system/certbot.service file to /etc/systemd/system/certbot.service?
Second, I want to restart a few services in my hooks, so would this line work?
ExecStart=/usr/bin/certbot renew --post-hook “systemctl restart nginx, systemctl restart dovcot, systemctl restart postfix”
(Not sure I need to restart dovecot)