fix: avoid closing connection when SIGINT
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing

This commit is contained in:
Davide Polonio 2023-05-25 10:54:45 +02:00
parent b466024001
commit 15ce6246fe

View File

@ -20,9 +20,8 @@ editWithRestart() {
local full_path_file_to_edit="${1}" local full_path_file_to_edit="${1}"
nano "${full_path_file_to_edit}" nano "${full_path_file_to_edit}"
stdout "The server will now be restarted and you will be attached to the logs." 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)" stdout "Use ctrl-c to detach from the logs (the service will continue to run in background)"
sleep 2 (cd "${VRISING_COMPOSE_HOME}" && bash -c "docker-compose restart && docker-compose logs -f")
(cd "${VRISING_COMPOSE_HOME}" && docker-compose restart && docker-compose logs -f)
} }
USERNAME="${1}" USERNAME="${1}"
@ -53,7 +52,7 @@ Select one of the following actions:
""" """
ACTION="-1" ACTION="-1"
read -r ACTION read -rp "> " ACTION
case "${ACTION}" in case "${ACTION}" in
0) 0)
@ -67,18 +66,15 @@ Select one of the following actions:
;; ;;
3) 3)
stdout "Use ctrl-c to detach from the logs at any time" stdout "Use ctrl-c to detach from the logs at any time"
sleep 2 (cd "${VRISING_COMPOSE_HOME}" && bash -c "docker-compose logs -f")
(cd "${VRISING_COMPOSE_HOME}" && docker-compose logs -f)
;; ;;
4) 4)
stdout "Use ctrl-c to detach from the logs at any time" stdout "Use ctrl-c to detach from the logs at any time"
sleep 2 (cd "${VRISING_COMPOSE_HOME}" && bash -c "docker-compose restart && docker-compose logs -f")
(cd "${VRISING_COMPOSE_HOME}" && docker-compose restart && docker-compose logs -f)
;; ;;
5) 5)
stdout "Use ctrl-c to detach from the logs at any time" stdout "Use ctrl-c to detach from the logs at any time"
sleep 2 (cd "${VRISING_COMPOSE_HOME}" && bash -c "docker-compose down -v && sleep 1 && docker-compose up -d && docker-compose logs -f")
(cd "${VRISING_COMPOSE_HOME}" && 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" stderr "The provided input is not valid. Please chose from the listed actions"