diff --git a/install-update.sh b/install-update.sh new file mode 100755 index 0000000..c3aa677 --- /dev/null +++ b/install-update.sh @@ -0,0 +1,2 @@ +#!/bin/sh +steamcmd +@sSteamCmdForcePlatformType linux +force_install_dir /hdd/data/steamcmd/vallheim +login anonymous +app_update 896660 public validate +quit diff --git a/log-parser-start.sh b/log-parser-start.sh new file mode 100755 index 0000000..96d1c11 --- /dev/null +++ b/log-parser-start.sh @@ -0,0 +1,4 @@ +#!/bin/bash +cd /hdd/data/steamcmd/vallheim +screen -dmS log-parser ./log-parser.sh + diff --git a/log-parser.sh b/log-parser.sh new file mode 100755 index 0000000..86db742 --- /dev/null +++ b/log-parser.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +BOTNUMBER="+420xxxyyyyyyyyy" +TARGETNUMBER="+420xxxzzzzzzzzz" + +mkdir -p .run +jcfile=".run/join-code.txt" +while true; do + + check=$(grep "Session" logs/valheim.log | grep -i "registered" | grep -i "join code" | tail -1 | sed "s/.* join code \(.*\)/\1/") + + if [[ ! -f "$jcfile" ]]; then + echo "$check" > "$jcfile" + elif [[ ! "$check" == $(cat $jcfile) ]]; then + 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 + fi + errcheck=$(grep -ic "code '4098': the operation was called with an invalid handle" logs/valheim.log) + if [[ $errcheck == 1 ]]; then + datum=$(date +"[%d.%m.%Y %H:%M] ") + 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 + fi + sleep 30 +done diff --git a/valheim-start-raw.sh b/valheim-start-raw.sh new file mode 100755 index 0000000..0153eae --- /dev/null +++ b/valheim-start-raw.sh @@ -0,0 +1,12 @@ +#!/bin/bash +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/" + +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 +export LD_LIBRARY_PATH=$templdpath + diff --git a/valheim-svc.sh b/valheim-svc.sh new file mode 100755 index 0000000..f142e05 --- /dev/null +++ b/valheim-svc.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +cd /hdd/data/steamcmd/vallheim +check=$(ps -ef | grep -v grep | grep -ic [v]alheim_server.x86_64) + +while true; do + check=$(ps -ef | grep -v grep | grep -ic [v]alheim_server.x86_64) + if [ $check -eq 0 ]; then + ./valheim-start-raw.sh + fi + sleep 15 +done +