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

@@ -7,58 +7,54 @@
# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
# General Settings
# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
export DAYZ_FILES=/mnt/dayz
export STOCK_SERVER_DATA="$DAYZ_FILES/stock/DayZServer"
export MAIN="/mnt/c/DAYZ"
export SERVERS="$MAIN/servers"
export CACHE="$MAIN/cache"
export MOD_CACHE="$CACHE/mods"
export RESTART_INTERVAL=$((60 * 60 * 4 + 3))
# export DAYZ_FILES=/mnt/dayz
# export STOCK_SERVER_DATA="$DAYZ_FILES/stock/DayZServer"
# export MAIN="/mnt/c/DAYZ"
# export SERVERS="$MAIN/servers"
# export CACHE="$MAIN/cache"
# export MOD_CACHE="$CACHE/mods"
# export RESTART_INTERVAL=$((60 * 60 * 4 + 3))
# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
# Helper functions
# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
alias do_sync='rsync -rltDh --delete --partial'
msg() {
>&2 printf '[*] %s ...\n' "$*"
}
warn() {
>&2 printf '\n\n<<<< WARNING: %s >>>>>\n\n' "$*"
}
die() {
msg "$*"
exit 1
}
debug() {
if [ "$DEBUG" ] ; then
>&2 printf ' DEBUG: %s\n' "$*"
fi
}
# alias do_sync='rsync -rltDh --delete --partial'
# msg() {
# >&2 printf '[*] %s ...\n' "$*"
# }
# warn() {
# >&2 printf '\n\n<<<< WARNING: %s >>>>>\n\n' "$*"
# }
# die() {
# msg "$*"
# exit 1
# }
# debug() {
# if [ "$DEBUG" ] ; then
# >&2 printf ' DEBUG: %s\n' "$*"
# fi
# }
# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
# Checks
# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
check() {
mkdir -p "$DAYZ_FILES"
# check() {
# mkdir -p "$DAYZ_FILES"
if ! mount | grep -i "$DAYZ_FILES" >/dev/null ; then
msg "$DAYZ_FILES is not mounted!"
echo "hint: mount -t drvfs //truenas.home.weaver/dayz $DAYZ_FILES"
exit 1
fi
# if ! mount | grep -i "$DAYZ_FILES" >/dev/null ; then
# msg "$DAYZ_FILES is not mounted!"
# echo "hint: mount -t drvfs //truenas.home.weaver/dayz $DAYZ_FILES"
# exit 1
# fi
if [ ! -d "$MAIN" ] ; then
die "$MAIN does not exist"
fi
# if [ ! -d "$MAIN" ] ; then
# die "$MAIN does not exist"
# fi
if [ ! -d "$STOCK_SERVER_DATA" ] ; then
die "$STOCK_SERVER_DATA does not exist"
fi
}
# if [ ! -d "$STOCK_SERVER_DATA" ] ; then
# die "$STOCK_SERVER_DATA does not exist"
# fi
# }
# -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
# Environment Setup