ISPConfig-Stuff/le_services_restart.sh

48 lines
1.5 KiB
Bash
Raw Normal View History

#!/bin/sh
### BEGIN INIT INFO
2025-01-15 21:40:28 +01:00
# Provides: LE SERVICES CERT AUTO UPDATER
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
2025-01-15 21:40:28 +01:00
# Short-Description: LE SERVICES CERT AUTO UPDATER
# Description: Restart services automatically when a new Let's Encrypt certificate is issued.
### END INIT INFO
2025-01-15 21:53:55 +01:00
# postfix
FILE=/etc/postfix/main.cf
if [ -f "$FILE" ]; then
systemctl restart influxd
fi
# dovecot
FILE=/etc/dovecot/dovecot.conf
if [ -f "$FILE" ]; then
systemctl restart dovecot
fi
2025-01-15 21:40:28 +01:00
# pro-tftp
2025-01-15 21:53:55 +01:00
FILE=/etc/pure-ftpd/pure-ftpd.conf
if [ -f "$FILE" ]; then
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
fi
2025-01-15 21:40:28 +01:00
# influxdb
FILE=/etc/influxdb/influxdb.pem
if [ -f "$FILE" ]; then
2025-01-15 21:53:55 +01:00
cat /root/.acme.sh/server.example.com/fullchain.pem > /etc/influxdb/influxdb.pem
cat /etc/letsencrypt/live/server.example.com/server.example.com.key > /etc/influxdb/influxdb.key
systemctl restart influxd
2025-01-15 21:40:28 +01:00
fi
2025-01-15 21:53:55 +01:00
# coturn
FILE=/usr/local/etc/turn_server_cert.pem
if [ -f "$FILE" ]; then
cat /root/.acme.sh/server.example.com/fullchain.pem > /usr/local/etc/turn_server_cert.pem
cat /etc/letsencrypt/live/server.example.com/server.example.com.key > /usr/local/etc/turn_server_pkey.pem
chown turnserver /usr/local/etc/turn_server*
systemctl restart coturn
fi
2025-01-15 21:40:28 +01:00