Find and use network name when restarting force the affected backend proxy

This commit is contained in:
2022-09-10 06:19:28 +00:00
parent c6343a976a
commit 4922bebdc8
2 changed files with 6 additions and 1 deletions

View File

@@ -49,6 +49,11 @@ do_proxy_restart() {
sleep $TIMEOUT;
echo "Proxy "$PROXY_NAME" restarting in progress";
$service_exec $SERVICE_NAME.containers.$PROXY_NAME stop force;
# finding network name for starting affected network
NETWORK_NAME=$(jq -r --arg NAME $PROXY_NAME '.containers[] | select(.NAME==$NAME)' $PROXY_SERVICE_FILE | jq -r .NETWORK)
$service_exec $SERVICE_NAME.networks.$NETWORK_NAME start
$service_exec $SERVICE_NAME.containers.$PROXY_NAME start
if docker ps | grep $PROXY_NAME ; then
echo "$PROXY_NAME restarted successful";

View File

@@ -17,7 +17,7 @@ mkdir -p $CERT_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,MOVED_TO -r $DOMAIN_DIR $CERT_DIR $PROXY_CONFIG_DIR | \
while read dir op file
do