add setup.sh

This commit is contained in:
sup39 2022-06-18 02:09:10 +09:00
parent 83e32fcac8
commit b99106ecb0
2 changed files with 21 additions and 1 deletions

View file

@ -1,7 +1,13 @@
# certrenew.service
A sample to configure certbot auto renew with systemd
## Reference
## Download
```sh
# assuming you have `wget` installed
wget -qO- l.sup39.dev/certrenew | sh -
```
## References
- [crontabを捨てsystemdに定期実行を任せよう。(narikei)](https://qiita.com/narikei/items/ca4823c7f6790f0cbe0b)
- [systemd .timerについて調べた事を記事にしておく(SOUICHIROU)](https://www.souichi.club/raspberrypi/systemd-timer/#OnCalendar)
- [How do I reload a group of systemd services?](https://unix.stackexchange.com/questions/334471/how-do-i-reload-a-group-of-systemd-services)

14
setup.sh Normal file
View file

@ -0,0 +1,14 @@
#!/bin/sh
baseURL=https://raw.githubusercontent.com/sup39/certrenew.service/master
dst=/etc/systemd/system
if [ ! -w "$dst" ]; then
echo "$dst is not writable. Download to /tmp instead"
dst=/tmp
fi
wget -P "$dst" "$baseURL/certrenew.service" "$baseURL/certrenew.timer" "$baseURL/certrenew.target" "$baseURL/certrenew.path"
cat <<EOF
Next step:
(1) edit $dst/certrenew.service
(2) $ sudo systemctl enable certrenew.service certrenew.timer certrenew.path
(3) $ sudo systemctl start certrenew.service certrenew.timer certrenew.target certrenew.path
EOF