From 23378625bbe72b9a6016feb1376f363c56696ada Mon Sep 17 00:00:00 2001 From: FezVrasta Date: Fri, 26 Jun 2015 19:27:59 +0200 Subject: [PATCH] added check config function --- tools/arkmanager | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tools/arkmanager b/tools/arkmanager index a58b920..e7b05e5 100755 --- a/tools/arkmanager +++ b/tools/arkmanager @@ -33,6 +33,7 @@ bnumber="" timestamp=$( date +%T ) GREEN="\\033[1;32m" RED="\\033[1;31m" +YELLOW="\\e[0;33m" NORMAL="\\033[0;39m" maxOpenFiles=100000 @@ -43,6 +44,41 @@ arkserverLog="arkserver.log" # here is logged the output of ShooterGameServer # functions #--------------------- +# +# check configuration and report errors +# +checkConfig() { + # SteamCMD configuration + # steamcmdroot + if [ ! -d "$steamcmdroot" ] ; then + echo -e "[" "$RED" "ERROR" "$NORMAL" "]" "\tYour SteamCMD root seems not valid." + fi + # steamcmdexec + if [ ! -f "$steamcmdroot/$steamcmdexec" ] ; then + echo -e "[" "$RED" "ERROR" "$NORMAL" "]" "\tYour SteamCMD exec could not be found." + fi + # steamcmd_user + if [ ! getent passwd $steamcmd_user > /dev/null 2>&1 ] ; then + echo -e "[" "$RED" "ERROR" "$NORMAL" "]" "\tYour SteamCMD user is not valid." + fi + + # Environment configuration + # arkserverroot + if [ ! -w `echo "$arkserverroot" | sed 's:/[^/]*$::'` ] ; then + echo -e "[" "$RED" "ERROR" "$NORMAL" "]" "\tYou have not rights to write in the defined ARK server root directory" + fi + # arkserverexec + if [ ! -f "$arkserverroot/$arkserverexec" ] ; then + echo -e "[" "$YELLOW" "WARN" "$NORMAL" "]" "\tYour SteamCMD exec could not be found." + fi + + # Service configuration + # logdir + if [ ! -w "$logdir" ] ; then + echo -e "[" "$RED" "ERROR" "$NORMAL" "]" "\tYou have not rights to write in the log directory." + fi +} + # # Check if a new version is available but not apply it # @@ -309,6 +345,10 @@ doUpgrade() { #--------------------- # Main program #--------------------- + +# check the configuration and throw errors or warnings if needed +checkConfig + case "$1" in start) doStart