fix: set right path for log, update output
parent
c3cfd99f17
commit
9ebb0a056d
|
@ -21,7 +21,7 @@ log() {
|
||||||
local when=""
|
local when=""
|
||||||
when="$(date +%R:%S)"
|
when="$(date +%R:%S)"
|
||||||
|
|
||||||
echo "${when} - ${action}" >> "${THIS_LOG}" 2>&1 /dev/null
|
echo "${when} - ${action}" >> "${THIS_LOG}"
|
||||||
}
|
}
|
||||||
|
|
||||||
editWithRestart() {
|
editWithRestart() {
|
||||||
|
@ -29,7 +29,7 @@ editWithRestart() {
|
||||||
nano "${full_path_file_to_edit}"
|
nano "${full_path_file_to_edit}"
|
||||||
log "File edit - ${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 "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"
|
log "Server restart"
|
||||||
(cd "${VRISING_COMPOSE_HOME}" && docker-compose restart && docker-compose logs -f)
|
(cd "${VRISING_COMPOSE_HOME}" && docker-compose restart && docker-compose logs -f)
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ GAME_SETTINGS="ServerGameSettings.json"
|
||||||
HOST_SETTINGS="ServerHostSettings.json"
|
HOST_SETTINGS="ServerHostSettings.json"
|
||||||
VRISING_COMPOSE_HOME="/home/davide/services/vrising/"
|
VRISING_COMPOSE_HOME="/home/davide/services/vrising/"
|
||||||
LOGS_FOLDER="${HOME}/logs"
|
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)
|
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}"
|
editWithRestart "${BASE_VRISING_FOLDER}${HOST_SETTINGS}"
|
||||||
;;
|
;;
|
||||||
3)
|
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"
|
log "Show logs"
|
||||||
(cd "${VRISING_COMPOSE_HOME}" && 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 disconnect from the server at any time"
|
||||||
log "Server restart"
|
log "Server restart"
|
||||||
(cd "${VRISING_COMPOSE_HOME}" && 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 disconnect from the server at any time"
|
||||||
log "Recreate server"
|
log "Recreate server"
|
||||||
(cd "${VRISING_COMPOSE_HOME}" && 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)
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in New Issue