ARK: Survival Evolved

Automatic Update for Linux Servers

Automatic Update for Linux

As announced in the windows auto update thread: Here is the Linux version of it!

Requirements

rcon (How to: http://www.ark-survival.net/en/2015/07/09/rcon-tutorial/)

Automatic Update for Linux – Script

Save this spoiler as bash file, like update.sh.

[sourcecode toolbar=”true” language=”bash” title=”update.cmd”]
#!/bin/bash
STEAMDIR=/home/steam/Steam
STEAMCMDDIR=/home/steam/steamcmd
STEAMCMDSCRIPT=update.txt
SERVERDIR=/home/steam/ark
RCONPASSWORD=YOURRCONPASSWORD
RCONIP=127.0.0.1
RCONPORT=32330
RCONFILE=/home/steam/rcon
SCREEN=ark
SERVERSTARTCOMMAND=$SERVERDIR"/ShooterGame/Binaries/Linux/ShooterGameServer \"TheIsland?QueryPort=27015?Port=7777?SetCheatPlayer=True?RCONEnabled=True?RCONPort="$RCONPORT"?listen\" -servergamelog -server -log"

cd $HOMEDIR
if [ ! -f $SERVERDIR/latestinstalledupdate.txt ] ; then
touch $SERVERDIR/latestinstalledupdate.txt
echo "0" > $SERVERDIR/latestinstalledupdate.txt
fi
if [ -f $SERVERDIR/updateinprogress.dat ] ; then
if [ $(( (`date +%s` – `stat -L –format %Y $SERVERDIR/updateinprogress.dat`) > (60*60) )) -eq 1 ] ; then
rm -f $SERVERDIR/updateinprogress.dat
fi
fi
if [ ! -f $SERVERDIR/updateinprogress.dat ] ; then
touch $SERVERDIR/updateinprogress.dat
rm -fr $STEAMDIR/appcache
$STEAMCMDDIR/steamcmd.sh +login anonymous +app_info_update 1 +app_info_print "376030" +quit | grep -EA 1000 "^\s+\"branches\"$" | grep -EA 5 "^\s+\"public\"$" | grep -m 1 -EB 10 "^\s+}$" | grep -E "^\s+\"buildid\"\s+" | tr ‘[:blank:]"’ ‘ ‘ | tr -s ‘ ‘ | cut -d’ ‘ -f3 > $SERVERDIR/latestavailableupdate.txt
sleep 1m
LATESTUPDATE=`cat $SERVERDIR/latestavailableupdate.txt`
INSTALLEDUPDATE=`cat $SERVERDIR/latestinstalledupdate.txt`
if [ "$LATESTUPDATE" != "$INSTALLEDUPDATE" ] && [ "$LATESTUPDATE" != "" ] && [ "$INSTALLEDUPDATE" != "" ]
then
$RCONFILE -P$RCONPASSWORD -a$RCONIP -p$RCONPORT broadcast New update available, server is restarting in 10 minutes!
sleep 5m
$RCONFILE -P$RCONPASSWORD -a$RCONIP -p$RCONPORT broadcast New update available, server is restarting in 5 minutes!
sleep 4m
$RCONFILE -P$RCONPASSWORD -a$RCONIP -p$RCONPORT saveworld
sleep 1m
$RCONFILE -P$RCONPASSWORD -a$RCONIP -p$RCONPORT doexit
sleep 10
if [ -f $SERVERDIR/ShooterGame/Saved/SavedArks/TheIsland.ark ] ; then
COUNTER=0
while [ $COUNTER -lt 5 ]; do
if [ $(( (`date +%s` – `stat -L –format %Y $SERVERDIR/ShooterGame/Saved/SavedArks/TheIsland.ark`) > (2*60) )) -eq 1 ] ; then
COUNTER=5
fi
sleep 1m
done
$RCONFILE -P$RCONPASSWORD -a$RCONIP -p$RCONPORT broadcast New update available, server is restarting!
fi
echo "$(date) Update – $(echo $INSTALLEDUPDATE) to $(echo $LATESTUPDATE)" >> $(echo $SERVERDIR)/Updatelog.txt
$STEAMCMDDIR/steamcmd.sh +runscript $STEAMCMDSCRIPT
$STEAMCMDDIR/steamcmd.sh +login anonymous +app_info_update 1 +app_info_print "376030" +app_info_print "376030" +quit | grep -EA 1000 "^\s+\"branches\"$" | grep -EA 5 "^\s+\"public\"$" | grep -m 1 -EB 10 "^\s+}$" | grep -E "^\s+\"buildid\"\s+" | tr ‘[:blank:]"’ ‘ ‘ | tr -s ‘ ‘ | cut -d’ ‘ -f3 > $SERVERDIR/latestinstalledupdate.txt
rm -f $SERVERDIR/updateinprogress.dat
screen -wipe
screen -dmS $SCREEN $SERVERSTARTCOMMAND
else
rm -f $SERVERDIR/updateinprogress.dat
fi
fi
[/sourcecode]

Copy the update.txt to your steamcmd folder

[sourcecode toolbar=”true” language=”plain” title=”update.txt”]
//ark
@NoPromptForPassword 1
@ShutdownOnFailedCommand 0
nSubscribedAutoDownloadMaxSimultaneous 32
@cMaxContentServersToRequest 32
@cMaxInitialDownloadSources 32
@fMinDataRateToAttemptTwoConnectionsMbps 0.01
@fDownloadRateImprovementToAddAnotherConnection 0.01
login anonymous
force_install_dir ../ark/
app_update 376030
//validate
quit
[/sourcecode]

How to use?

You can use Crontab to schedule this update.

Updates

-Added suggestions from the comments, thx for that

Exit mobile version