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

@@ -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,34 +22,30 @@ 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;
/scripts/check_proxy_state.sh $DOMAIN;
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;
fi
elif [[ "${parent}" == "${DOMAIN_DIR}" && "${op}" == "CLOSE_WRITE,CLOSE" ]]; then
DOMAIN=$(echo $file);
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