fix: set right path for log, update output
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details

vrising
Davide Polonio 2023-05-25 11:17:57 +02:00
parent c3cfd99f17
commit 9ebb0a056d
1 changed files with 6 additions and 6 deletions

View File

@ -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)
;;