#!/bin/sh
set -e
DIR=/etc/config/QcloudSSLCertificate/cert
SUM=""
while true; do
NEWSUM=$(md5sum "$DIR/cert" "$DIR/key" "$DIR/chain" 2>/dev/null | md5sum | cut -d' ' -f1)
if [ "$NEWSUM" != "$SUM" ]; then
SUM="$NEWSUM"
docker exec dms_nginx nginx -t && docker exec dms_nginx nginx -s reload || true
fi
sleep 3600
done