1
0
Fork 0
This commit is contained in:
Joao M 2022-08-17 21:55:25 +00:00
parent 21a4a056cb
commit ad8aef16a2
11 changed files with 91 additions and 36 deletions

View file

@ -44,13 +44,11 @@ if cmp -s ${CONTROL_FILE} ${CONTROL_FILE}.old ; then
fi
if [[ ! -z "$1" ]]; then
echo "[CONF_CHECK] Initial configuration"
RELOAD="false"
echo "[CONF_CHECK] Initial configuration. Skip certbot."
else
/scripts/certbot.sh
fi
# If Certbot reloads successfully will create the file /tmp/force-reload
if [ -f /tmp/force-reload ]; then
echo "[CONF_CHECK] New certificates found..."
@ -58,7 +56,12 @@ if [ -f /tmp/force-reload ]; then
rm /tmp/force-reload
fi
if [[ ! -z "$1" ]]; then
echo "[CONF_CHECK] Start haproxy"
/usr/sbin/haproxy -W -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -S /var/run/haproxy.sock
fi
if [[ "$RELOAD" == "true" ]]; then
echo "[CONF_CHECK] Reloading..."
/usr/sbin/haproxy -W -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -x /var/run/haproxy.sock -sf $(cat /run/haproxy.pid) &
/usr/sbin/haproxy -W -f /etc/haproxy/haproxy.cfg $(ls /etc/haproxy/conf.d/*.cfg 2>/dev/null | xargs -I{} echo -f {}) -p /run/haproxy.pid -x /var/run/haproxy.sock -sf $(cat /run/haproxy.pid) &
fi

View file

@ -1,8 +1,8 @@
#!/usr/bin/env bash
source /scripts/haproxy-reload.sh initial
/usr/sbin/haproxy -v
/usr/sbin/haproxy -W -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -S /var/run/haproxy.sock
source /scripts/haproxy-reload.sh initial
while true; do
sleep 60