From 9ebb0a056d66ce1d03d2483d9b4df23c97093409 Mon Sep 17 00:00:00 2001 From: Davide Polonio Date: Thu, 25 May 2023 11:17:57 +0200 Subject: [PATCH] fix: set right path for log, update output --- vrising/src/vrising.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/vrising/src/vrising.sh b/vrising/src/vrising.sh index 8c70e02..34ab67b 100755 --- a/vrising/src/vrising.sh +++ b/vrising/src/vrising.sh @@ -21,7 +21,7 @@ log() { local when="" when="$(date +%R:%S)" - echo "${when} - ${action}" >> "${THIS_LOG}" 2>&1 /dev/null + echo "${when} - ${action}" >> "${THIS_LOG}" } editWithRestart() { @@ -29,7 +29,7 @@ editWithRestart() { nano "${full_path_file_to_edit}" log "File edit - ${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 in background)" + stdout "Use ctrl-c to disconnect from the server" log "Server restart" (cd "${VRISING_COMPOSE_HOME}" && docker-compose restart && docker-compose logs -f) } @@ -52,7 +52,7 @@ GAME_SETTINGS="ServerGameSettings.json" HOST_SETTINGS="ServerHostSettings.json" VRISING_COMPOSE_HOME="/home/davide/services/vrising/" LOGS_FOLDER="${HOME}/logs" -THIS_LOG="${USERNAME}-$(date --iso-8601=ns).log" +THIS_LOG="${LOGS_FOLDER}/${USERNAME}-$(date --iso-8601=ns).log" mkdir -p "${LOGS_FOLDER}" || (stderr "Unable to create logs folder, exiting" && exit 1) @@ -85,17 +85,17 @@ Select one of the following actions: editWithRestart "${BASE_VRISING_FOLDER}${HOST_SETTINGS}" ;; 3) - stdout "Use ctrl-c to detach from the logs at any time" + stdout "Use ctrl-c to disconnect from the server at any time" log "Show logs" (cd "${VRISING_COMPOSE_HOME}" && docker-compose logs -f) ;; 4) - stdout "Use ctrl-c to detach from the logs at any time" + stdout "Use ctrl-c to disconnect from the server at any time" log "Server restart" (cd "${VRISING_COMPOSE_HOME}" && docker-compose restart && docker-compose logs -f) ;; 5) - stdout "Use ctrl-c to detach from the logs at any time" + stdout "Use ctrl-c to disconnect from the server at any time" log "Recreate server" (cd "${VRISING_COMPOSE_HOME}" && docker-compose down -v && sleep 1 && docker-compose up -d && docker-compose logs -f) ;;