Add uptime to status.

Updated docs.
This commit is contained in:
Daniel Ceregatti 2022-07-23 22:09:57 -07:00
parent 71f381ec3d
commit e71ed82871
2 changed files with 47 additions and 36 deletions

View file

@ -152,8 +152,16 @@ the running container:
docker compose exec main bash docker compose exec main bash
``` ```
Or open a shell into a new container if the docker stack is not up:
```
docker compose run --rm main bash
```
All the files used by the server are in a docker volume. Any change made will be reflected upon the next container startup.
Use this shell cautiously. Use this shell cautiously.
## TODO ## TODO
* Create some way to send messages to players on the server using RCON. * Create some way to send messages to players on the server using RCON.
* Implement multiple ids for mod commands.

View file

@ -266,8 +266,7 @@ fn_install_dayz(){
fi fi
} }
fn_runupdate_dayz(){ fn_config(){
fn_steamlogin_dayz
if ! diff -q "${SERVER_CFG_SRC}" "${SERVER_CFG_DST}" if ! diff -q "${SERVER_CFG_SRC}" "${SERVER_CFG_DST}"
then then
echo "=========================================================================" echo "========================================================================="
@ -281,7 +280,6 @@ fn_runupdate_dayz(){
echo "NOT updating the server configuration file" echo "NOT updating the server configuration file"
fi fi
fi fi
${STEAMCMD} +force_install_dir ${SERVER_FILES} +login "${steamlogin}" +app_update "${appid}" +quit
} }
fn_update_dayz(){ fn_update_dayz(){
@ -313,7 +311,8 @@ fn_update_dayz(){
printf "\thttps://steamdb.info/app/${appid}/\n" printf "\thttps://steamdb.info/app/${appid}/\n"
printf "\nApplying update" printf "\nApplying update"
# run update # run update
fn_runupdate_dayz fn_steamlogin_dayz
${STEAMCMD} +force_install_dir ${SERVER_FILES} +login "${steamlogin}" +app_update "${appid}" +quit
fn_update_mods fn_update_mods
else else
printf "\r[ ${green}OK${default} ] Checking for update:: No update available\n" printf "\r[ ${green}OK${default} ] Checking for update:: No update available\n"
@ -529,8 +528,7 @@ fn_status(){
LOGGED_IN="${NO}" LOGGED_IN="${NO}"
RUNNING="${NO}" RUNNING="${NO}"
fn_get_mods fn_get_mods
MOD_INSTALLED="${green}${#workshopID[@]}${default}" MODS_INSTALLED="${green}${#workshopID[@]}${default}"
MOD_LIST=""
# DayZ Server files installation # DayZ Server files installation
if [ -f "${SERVER_INSTALL_FILE}" ] if [ -f "${SERVER_INSTALL_FILE}" ]
then then
@ -542,9 +540,9 @@ fn_status(){
LOGGED_IN="${YES}" LOGGED_IN="${YES}"
if grep -q anonymous "${STEAM_LOGIN}" if grep -q anonymous "${STEAM_LOGIN}"
then then
ANONYMOUS="(as anonymous)" ANONYMOUS="${yellow}(as anonymous)${default}"
else else
ANONYMOUS="(not anonymous)" ANONYMOUS="${green}(not anonymous)${default}"
fi fi
fi fi
# Running or not # Running or not
@ -553,13 +551,16 @@ fn_status(){
RUNNING="${YES}" RUNNING="${YES}"
fi fi
fn_mod_cmd fn_mod_cmd
# Uptime
UPTIME=$(date -d@$(($(date +%s) - $(date +%s -r ${SERVER_PROFILE}/server_console.log))) -u +%H:%M:%S)
# Number of mods plus the list denoting on or off # Number of mods plus the list denoting on or off
echo -e " echo -e "
Status: Status:
Uptime: ${green}${UPTIME}${default}
Logged in to Steam: ${LOGGED_IN} ${ANONYMOUS} Logged in to Steam: ${LOGGED_IN} ${ANONYMOUS}
Server files installed: ${INSTALLED} Server files installed: ${INSTALLED}
Mods installed: ${MOD_INSTALLED}${MOD_LIST} Mods installed: ${MODS_INSTALLED}
Server running: ${RUNNING} Server running: ${RUNNING}
Default parameters:${dayzparameter} Default parameters:${dayzparameter}
Mod parameter: ${mod_command_line} Mod parameter: ${mod_command_line}
@ -570,6 +571,9 @@ case "${1}" in
cmd) cmd)
fn_mod_cmd fn_mod_cmd
;; ;;
config)
fn_config
;;
install) install)
fn_loadconfig_dayz fn_loadconfig_dayz
fn_install_dayz fn_install_dayz
@ -595,7 +599,6 @@ case "${1}" in
fn_stop_dayz fn_stop_dayz
;; ;;
update) update)
fn_runupdate_dayz
fn_loadconfig_dayz fn_loadconfig_dayz
fn_update_dayz fn_update_dayz
;; ;;