updated to restart more services
This commit is contained in:
parent
252ebc6eb9
commit
6679fa74be
@ -1,9 +1,9 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description="Monitor the mailserver certificate files to trigger a e-mail services restart after the certificates has been renewed"
|
Description="Monitor the server certificate files to trigger a services restart after the certificates has been renewed"
|
||||||
|
|
||||||
[Path]
|
[Path]
|
||||||
PathModified=/root/.acme.sh/mail.example.com/
|
PathModified=/root/.acme.sh/server.example.com/
|
||||||
Unit=le-mailserver-restart.service
|
Unit=le-services-restart.service
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description="Run script to restart Postfix and Dovecot after the certificate has been renewed"
|
Description="Run script to restart Services after the certificate has been renewed"
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=/usr/local/bin/le_mailserver_restart.sh
|
ExecStart=/usr/local/bin/le_services_restart.sh
|
||||||
|
@ -1,15 +1,30 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
### BEGIN INIT INFO
|
### BEGIN INIT INFO
|
||||||
# Provides: LE MAILSERVER CERT AUTO UPDATER
|
# Provides: LE SERVICES CERT AUTO UPDATER
|
||||||
# Required-Start: $local_fs $network
|
# Required-Start: $local_fs $network
|
||||||
# Required-Stop: $local_fs
|
# Required-Stop: $local_fs
|
||||||
# Default-Start: 2 3 4 5
|
# Default-Start: 2 3 4 5
|
||||||
# Default-Stop: 0 1 6
|
# Default-Stop: 0 1 6
|
||||||
# Short-Description: LE MAILSERVER CERT AUTO UPDATER
|
# Short-Description: LE SERVICES CERT AUTO UPDATER
|
||||||
# Description: Restart mail server automatically when a new Let's Encrypt certificate is issued.
|
# Description: Restart services automatically when a new Let's Encrypt certificate is issued.
|
||||||
### END INIT INFO
|
### END INIT INFO
|
||||||
systemctl restart postfix
|
systemctl restart postfix
|
||||||
systemctl restart dovecot
|
systemctl restart dovecot
|
||||||
cat /root/.acme.sh/mail.example.com/fullchain.pem > /etc/ssl/private/pure-ftpd.pem
|
|
||||||
cat /root/.acme.sh/mail.example.com/mail.example.com.key >> /etc/ssl/private/pure-ftpd.pem
|
# pro-tftp
|
||||||
|
cat /root/.acme.sh/server.example.com/fullchain.pem > /etc/ssl/private/pure-ftpd.pem
|
||||||
|
cat /root/.acme.sh/server.example.com/server.example.com.key >> /etc/ssl/private/pure-ftpd.pem
|
||||||
systemctl restart pure-ftpd-mysql.service
|
systemctl restart pure-ftpd-mysql.service
|
||||||
|
|
||||||
|
# influxdb
|
||||||
|
FILE=/etc/influxdb/influxdb.pem
|
||||||
|
if [ -f "$FILE" ]; then
|
||||||
|
cat /root/.acme.sh/server.example.com/fullchain.pem > /etc/influxdb/influxdb.pem && systemctl restart influxd
|
||||||
|
cat /etc/letsencrypt/live/server.example.com/server.example.com.key > /etc/influxdb/influxdb.key && systemctl restart influxd
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,18 +4,18 @@ from: https://www.howtoforge.com/securing-your-ispconfig-3-managed-mailserver-wi
|
|||||||
|
|
||||||
|
|
||||||
``` sh
|
``` sh
|
||||||
nano /usr/local/bin/le_mailserver_restart.sh
|
nano /usr/local/bin/le_services_restart.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
``` sh
|
``` sh
|
||||||
chmod +x /usr/local/bin/le_mailserver_restart.sh
|
chmod +x /usr/local/bin/le_services_restart.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
``` sh
|
``` sh
|
||||||
nano /etc/systemd/system/le-mailserver-restart.service
|
nano /etc/systemd/system/le-services-restart.service
|
||||||
```
|
```
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
nano /etc/systemd/system/le-mailserver-restart.path
|
nano /etc/systemd/system/le-services-restart.path
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user