Minor changes.

This commit is contained in:
2021-09-07 12:44:19 +02:00
parent cf8660a4f2
commit ddfedda8dc
3 changed files with 16 additions and 16 deletions

View File

@@ -35,6 +35,7 @@ do_proxy_restart() {
$service_exec $SERVICE_NAME.containers.$PROXY_NAME start
if docker ps | grep $PROXY_NAME ; then
echo "$PROXY_NAME restarted successful";
break ;
else
echo "Restarting number is only: "$retries" so try again"
sleep $TIMEOUT;
@@ -46,6 +47,8 @@ do_proxy_restart() {
done
fi
done
cat $PROXY_CONFIG_DIR/new_config >> $PROXY_CONFIG_DIR/configs
rm $PROXY_CONFIG_DIR/new_config
}
check_domain() {

View File

@@ -130,4 +130,5 @@ fi
} >> "$file"
mv /tmp/$DOMAIN.conf $DOMAIN.conf
mv /tmp/$DOMAIN.conf $DOMAIN.conf;
echo "$DOMAIN" >> new_config

View File

@@ -13,7 +13,7 @@ PROXY_CONFIG_DIR=$PROXY_CONFIG_DIR
unset IFS
inotifywait --exclude .sw -m -e CREATE,CLOSE_WRITE,DELETE -r $DOMAIN_DIR $CERT_DIR $PROXY_CONFIG_DIR | \
inotifywait --exclude .sw -m -e CREATE,CLOSE_WRITE,DELETE -r $DOMAIN_DIR $CERT_DIR | \
while read dir op file
do
@@ -22,21 +22,11 @@ do
if [[ "${parent}" == "${CERT_DIR}" && "${op}" == "CLOSE_WRITE,CLOSE" ]] ; then
DOMAIN=$(echo $dir|cut -d / -f3);
if [ -f "$CERT_DIR/$DOMAIN/new_certificate" ]; then
if [[ -f $CERT_DIR/$DOMAIN/renew_certificate && ! -f $PROXY_CONFIG_DIR/new_config ]]; then
rm $CERT_DIR/$DOMAIN/renew_certificate;
echo "New cert created: '$DOMAIN'";
echo "newcert check proxy";
/scripts/check_proxy_state.sh;
fi
elif [[ "${parent}" == "${PROXY_CONFIG_DIR}" && "${op}" == "CLOSE_WRITE,CLOSE" ]]; then
echo "proxy config created, changed ";
/scripts/check_proxy_state.sh;
elif [[ "${parent}" == "${PROXY_CONFIG_DIR}" && "${op}" == "DELETE" ]] ; then
echo "proxy config deleted";
FILE=$(echo $file)
if [ ! -f "$PROXY_CONFIG_DIR/$FILE" ]; then
/scripts/check_proxy_state.sh;
/scripts/check_proxy_state.sh $DOMAIN;
fi
elif [[ "${parent}" == "${DOMAIN_DIR}" && "${op}" == "CLOSE_WRITE,CLOSE" ]]; then
@@ -44,12 +34,18 @@ do
echo "domain config created, changed";
/scripts/nginx_config_create.sh "$DOMAIN";
if [ -f "$PROXY_CONFIG_DIR/new_config" ] ; then
/scripts/check_proxy_state.sh "$DOMAIN";
fi
elif [[ "${parent}" == "${DOMAIN_DIR}" && "${op}" == "DELETE" ]] ; then
DOMAIN=$(echo $file);
echo "domain deleted";
if [ ! -f "$DOMAIN_DIR/$DOMAIN" ]; then
/scripts/nginx_config_create.sh "$DOMAIN" "DEL";
/scripts/check_proxy_state.sh "$DOMAIN" "DEL";
fi
fi