diff --git a/install-update.sh b/install-update.sh index c3aa677..4639306 100755 --- a/install-update.sh +++ b/install-update.sh @@ -1,2 +1,12 @@ #!/bin/sh -steamcmd +@sSteamCmdForcePlatformType linux +force_install_dir /hdd/data/steamcmd/vallheim +login anonymous +app_update 896660 public validate +quit + +#Configuration +conf_file="valheim-server.ini" + +# No need to change anything under this line + +command -v steamcmd >/dev/null 2>&1 || { echo >&2 "Please install steamcmd to the path"; exit 128; } + +. ./lib_ini.sh +server_path=$(ini_read "$conf_file" "server" "srvpath") +steamcmd +@sSteamCmdForcePlatformType linux +force_install_dir "$server_path" +login anonymous +app_update 896660 public validate +quit diff --git a/log-parser-start.sh b/log-parser-start.sh index 96d1c11..925a6ab 100755 --- a/log-parser-start.sh +++ b/log-parser-start.sh @@ -1,4 +1,15 @@ #!/bin/bash -cd /hdd/data/steamcmd/vallheim -screen -dmS log-parser ./log-parser.sh + +#Configuration +conf_file="valheim-server.ini" + +# No need to change anything under this line + +# source config parser +. ./lib_ini.sh +server_path=$(ini_read "$conf_file" "server" "srvpath") + +cd "$server_path" + +screen -dmS valheim-log-parser ./log-parser.sh diff --git a/log-parser.sh b/log-parser.sh index 86db742..8eb2165 100755 --- a/log-parser.sh +++ b/log-parser.sh @@ -1,7 +1,18 @@ #!/bin/bash -BOTNUMBER="+420xxxyyyyyyyyy" -TARGETNUMBER="+420xxxzzzzzzzzz" +#Configuration +conf_file="valheim-server.ini" + +# No need to change anything under this line + +# source config parser +. ./lib_ini.sh + +server_path=$(ini_read "$conf_file" "server" "srvpath") +bot_nr=$(ini_read "$conf_file" "parser" "botnr") +targ_nr=$(ini_read "$conf_file" "parser" "targnr") + +cd "$server_path" mkdir -p .run jcfile=".run/join-code.txt" @@ -15,8 +26,8 @@ while true; do echo "$check" > "$jcfile" datum=$(date +"[%d.%m.%Y %H:%M] ") message="$datum Valheim join code je: $check" - signal-cli -u "$BOTNUMBER" send -m "$message" "$TARGETNUMBER" &> /dev/null - signal-cli -u "$BOTNUMBER" receive &> /dev/null + signal-cli -u "$bot_nr" send -m "$message" "$targ_nr" &> /dev/null + signal-cli -u "$bot_nr" receive &> /dev/null fi errcheck=$(grep -ic "code '4098': the operation was called with an invalid handle" logs/valheim.log) if [[ $errcheck == 1 ]]; then @@ -24,8 +35,8 @@ while true; do message="$datum Valheim dedik chybuje - restart" srvpid=$(LANG=C ps -ef | grep -v grep | grep -i [v]alheim_server.x86_64 | cut -d" " -f3) kill $srvpid - signal-cli -u "$BOTNUMBER" send -m "$message" "$TARGETNUMBER" &> /dev/null - signal-cli -u "$BOTNUMBER" receive &> /dev/null + signal-cli -u "$bot_nr" send -m "$message" "$targ_nr" &> /dev/null + signal-cli -u "$bot_nr" receive &> /dev/null fi sleep 30 done diff --git a/valheim-start-raw.sh b/valheim-start-raw.sh index 0153eae..4b40a73 100755 --- a/valheim-start-raw.sh +++ b/valheim-start-raw.sh @@ -1,12 +1,35 @@ #!/bin/bash + +#Configuration +conf_file="valheim-server.ini" + +# No need to change anything under this line + +# source config parser +. ./lib_ini.sh + +server_path=$(ini_read "$conf_file" "server" "srvpath") +server_name=$(ini_read "$conf_file" "server" "srvname") +server_pass=$(ini_read "$conf_file" "server" "srvpass") +server_moded=$(ini_read "$conf_file" "server" "srvmoded") + +cd "$server_path" + +if [[ "$server_moded" == "true" ]]; then + # source modding engine + . ./bepinex_conf.inc +fi + +# standard startup routine export templdpath=$LD_LIBRARY_PATH export LD_LIBRARY_PATH=./linux64:$LD_LIBRARY_PATH export SteamAppID=892970 -GAMENAME="Pitrisskovo Hall of Lame" -BASEDIR="/hdd/data/steamcmd/vallheim/" +# Creating dirs +mkdir -p "$server_path/savedir" +mkdir -p "$server_path/logs" echo "Starting server..." -./valheim_server.x86_64 -name "$GAMENAME" -port 2456 -nographics -batchmode -world "GAMENAME" -password "" -public 1 -crossplay -savedir $BASEDIR/savedir -logFile $BASEDIR/logs/valheim.log -backups 8 -modifier raids none -modifier DeathPenalty casual -modifier Combat veryeasy +./valheim_server.x86_64 -name "$server_name" -port 2456 -nographics -batchmode -world "$server_name" -password "$server_pass" -public 1 -crossplay -savedir $server_path/savedir -logFile $server_path/logs/valheim.log -backups 8 -modifier raids none -modifier DeathPenalty casual -modifier Combat veryeasy export LD_LIBRARY_PATH=$templdpath diff --git a/valheim-start.sh b/valheim-start.sh index 86d9509..33918f4 100755 --- a/valheim-start.sh +++ b/valheim-start.sh @@ -1,4 +1,14 @@ #!/bin/bash -cd /hdd/data/steamcmd/vallheim + +#Configuration +conf_file="valheim-server.ini" + +# No need to change anything under this line +# source config parser +. ./lib_ini.sh + +server_path=$(ini_read "$conf_file" "server" "srvpath") + +cd "$server_path" screen -dmS valheim-server ./valheim-svc.sh diff --git a/valheim-svc.sh b/valheim-svc.sh index f142e05..a76824e 100755 --- a/valheim-svc.sh +++ b/valheim-svc.sh @@ -1,6 +1,15 @@ #!/bin/bash -cd /hdd/data/steamcmd/vallheim +#Configuration +conf_file="valheim-server.ini" + +# No need to change anything under this line +# source config parser +. ./lib_ini.sh + +server_path=$(ini_read "$conf_file" "server" "srvpath") + +cd "$server_path" check=$(ps -ef | grep -v grep | grep -ic [v]alheim_server.x86_64) while true; do