From 15ce6246fea11bdd57ddf76fbec4e3e41defc294 Mon Sep 17 00:00:00 2001 From: Davide Polonio Date: Thu, 25 May 2023 10:54:45 +0200 Subject: [PATCH] fix: avoid closing connection when SIGINT --- vrising/src/vrising.sh | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/vrising/src/vrising.sh b/vrising/src/vrising.sh index 390316c..7d7a729 100755 --- a/vrising/src/vrising.sh +++ b/vrising/src/vrising.sh @@ -20,9 +20,8 @@ editWithRestart() { local full_path_file_to_edit="${1}" nano "${full_path_file_to_edit}" stdout "The server will now be restarted and you will be attached to the logs." - stdout "Use ctrl-c to detach from the logs (the service will continue to run)" - sleep 2 - (cd "${VRISING_COMPOSE_HOME}" && docker-compose restart && docker-compose logs -f) + stdout "Use ctrl-c to detach from the logs (the service will continue to run in background)" + (cd "${VRISING_COMPOSE_HOME}" && bash -c "docker-compose restart && docker-compose logs -f") } USERNAME="${1}" @@ -53,7 +52,7 @@ Select one of the following actions: """ ACTION="-1" - read -r ACTION + read -rp "> " ACTION case "${ACTION}" in 0) @@ -67,18 +66,15 @@ Select one of the following actions: ;; 3) stdout "Use ctrl-c to detach from the logs at any time" - sleep 2 - (cd "${VRISING_COMPOSE_HOME}" && docker-compose logs -f) + (cd "${VRISING_COMPOSE_HOME}" && bash -c "docker-compose logs -f") ;; 4) stdout "Use ctrl-c to detach from the logs at any time" - sleep 2 - (cd "${VRISING_COMPOSE_HOME}" && docker-compose restart && docker-compose logs -f) + (cd "${VRISING_COMPOSE_HOME}" && bash -c "docker-compose restart && docker-compose logs -f") ;; 5) stdout "Use ctrl-c to detach from the logs at any time" - sleep 2 - (cd "${VRISING_COMPOSE_HOME}" && docker-compose down -v && sleep 1 && docker-compose up -d && docker-compose logs -f) + (cd "${VRISING_COMPOSE_HOME}" && bash -c "docker-compose down -v && sleep 1 && docker-compose up -d && docker-compose logs -f") ;; *) stderr "The provided input is not valid. Please chose from the listed actions"