Systemd timer for lego
Place lego.service and lego.service in /etc/systemd/system.
Place config in /var/lib/lego and nginx-example.com.sh in /var/lib/lego/scripts.
You should modify config and nginx-example.com.sh.
Finally execute sudo systemctl enable lego.timer.
Lego's files are stored in /var/lib/lego. You need to create this directory and use lego ... run to create acme account.
I'm using DNS challenge and didn't test HTTP challenge. Please tell me if it works.
Thank you for the code, it helped me a lot in configuring my setup.
FYI: It works fine with http.webroot.
Additionally, I run the "lego" service from a different user (by default the systemd runs from the root, which is not safe).