lockserver

This commit is contained in:
2023-11-25 01:05:22 -06:00
parent 4bc6f900b3
commit 4a718e39e4
4 changed files with 145 additions and 64 deletions

View File

@@ -1,9 +1,17 @@
#!/usr/bin/env bash
#
# shellcheck disable=2043
# 01. "should check code directly not $?"
# shellcheck disable=2181
#
# 02. "can't follow . import"
# shellcheck disable=1090
#
# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
##################### CHANGE ME #################################
export SERVER_NAME="XXXXXXXXXX"
##################### CHANGE ME #################################
# ===================================================
# 01. Attempt to load global DayZ values
# ===================================================
@@ -20,9 +28,45 @@ fi
# ===================================================
# 02. Local script variables
# ===================================================
#
#
# Local server file hierarchy:
#
# c:/DAYZ
# ^--/servers
# ^--/cache
#
export MAIN="/mnt/c/DAYZ"
export CACHE="$MAIN/cache"
export MOD_CACHE="$CACHE/mods"
export SERVERS="$MAIN/servers"
export SERVER_HOME="$SERVERS/$SERVER_NAME"
export RESTART_INTERVAL=$((60 * 60 * 4 + 3))
main() {
:
# ===================================================
# 03. init and checks
# ===================================================
check() {
if [ ! -d "$MAIN" ] ; then
die "dir: $MAIN does not exist"
fi
if [ ! -d "$SERVER_HOME" ] ; then
die "dir: $SERVER_HOME does not exist"
fi
msg "Health checks completed successfully."
}
main "$@"
init() {
check || die "Failed check()"
mkdir -p "$CACHE" "$MOD_CACHE"
msg "Completed intialization. Using server restart time of $RESTART_INTERVAL seconds."
}
# ===================================================
main() {
check || die "Failed check()"
}
main "$@" || exit 1