Automatic Update for Linux

Automatic Update for Linux Servers

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


rcon (How to:

Automatic Update for Linux – Script

Save this spoiler as bash file, like

[sourcecode toolbar=”true” language=”bash” title=”update.cmd”]
SERVERSTARTCOMMAND=$SERVERDIR"/ShooterGame/Binaries/Linux/ShooterGameServer \"TheIsland?QueryPort=27015?Port=7777?SetCheatPlayer=True?RCONEnabled=True?RCONPort="$RCONPORT"?listen\" -servergamelog -server -log"

if [ ! -f $SERVERDIR/latestinstalledupdate.txt ] ; then
touch $SERVERDIR/latestinstalledupdate.txt
echo "0" > $SERVERDIR/latestinstalledupdate.txt
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
if [ ! -f $SERVERDIR/updateinprogress.dat ] ; then
touch $SERVERDIR/updateinprogress.dat
rm -fr $STEAMDIR/appcache
$STEAMCMDDIR/ +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`
$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
sleep 1m
sleep 10
if [ -f $SERVERDIR/ShooterGame/Saved/SavedArks/TheIsland.ark ] ; then
while [ $COUNTER -lt 5 ]; do
if [ $(( (`date +%s` – `stat -L –format %Y $SERVERDIR/ShooterGame/Saved/SavedArks/TheIsland.ark`) > (2*60) )) -eq 1 ] ; then
sleep 1m
$RCONFILE -P$RCONPASSWORD -a$RCONIP -p$RCONPORT broadcast New update available, server is restarting!
echo "$(date) Update – $(echo $INSTALLEDUPDATE) to $(echo $LATESTUPDATE)" >> $(echo $SERVERDIR)/Updatelog.txt
$STEAMCMDDIR/ +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
rm -f $SERVERDIR/updateinprogress.dat

Copy the update.txt to your steamcmd folder

[sourcecode toolbar=”true” language=”plain” title=”update.txt”]
@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

How to use?

You can use Crontab to schedule this update.


-Added suggestions from the comments, thx for that

About the author

22 thoughts on “Automatic Update for Linux Servers”

  1. Bonsoir ! Merci pour ce script ! Cependant il existe des erreurs, la commande cut par exemple “cut -d\ -f3” et il me dit que trop de variable sont présentes dans le IF de vérification des fichiers textes.

    Merci !

  2. Correction ! Vous pouvez supprimer mon commentaire plus haut :).

    Je n’ai un soucis qu’avec la commande cut à priori, le IF étant une erreur de ma part. (J’ai retapé le script à la main pour l’optimisé sur notre serveur, en ajoutant un check du status du serveur pour le relancer si il a crash et qu’il n’y a pas d’update en cours.

    Avez vous une solution pour le cut ? Il m’indique simplement de me réferer à l’aide (syntaxe incorrecte.)

  3. Hi !

    Thanks for that. Little problem anyway, it say that the cut command is wrong. then throw an error for TR variable.

    Thanks for the fix. (I’m looking too)

  4. Fix for the cut issue:

    There are two very long lines (starting with “$STEAMCMDDIR/ +login ……”).
    At the end there is a “cut -d\ -f3”. Change this to “cut -d’ ‘ -f3” – so basically replace the backslash with two ticks with a space in the middle (\ -> ‘ ‘)

    Works for me, thanks a lot!

  5. Also, there are two other little errors:
    Around line 28 and line 33, where rcon is called there is a space missing between “-a$RCONIP-p$RCONPORT”. It should read “-a$RCONIP -p$RCONPORT” as on the other lines

    And: I like to put my arkserver in a screen, so it continues to run even after killing the terminal. My SERVERSTARTCOMMAND reads:
    “screen -A -m -d -S ark sudo -u arkuser /opt/steam/arkserver/ShooterGame/Binaries/Linux/ShooterGameServer \”TheIsland?listen?SessionName=Server?ServerAdminPassword=Password?ServerPVE=True?ServerCrosshair=True?AlwaysNotifyPlayerLeft=True?MapPlayerLocation=True?RCONEnable=True?RCONPort=32330\” -server -log”

    Cheers, Phil

    1. fixed it + You could run it in a screen by replacing “$SERVERSTARTCOMMAND” with “screen -U -dmS ArkScreen $SERVERSTARTCOMMAND”

  6. ./ +login anonymous +app_info_update 1 +app_info_print “376030” +quit

    This command does not return the latest version of the buildid, rather an outdated list from several days ago. It’s not until the server is manually updated via steam that the +app_info_print command returns newer values for the buildid. What am I doing wrong? I’ve tried deleting the $STEAMDIR/appcache folder… Any ideas? Thanks for the groundwork on this!

      1. Hi guy !
        Could anyone show me the code inside the $STEAMCMDSCRIPT files
        because for mine is not working

        ex. for my code is : (update.txt)
        login USERNAME PASSWORD +force_install_dir /home/steam/arkdedicated +app_update 376030 validate +quit

  7. Thanks for this!

    Quick question, does it need to run as root? My normal server scripts always change to my “steam” user which doesn’t have root privileges before executing. I ask because when I tried running the above script (before scheduling in cron) as my “steam” user it wanted root perms.

    1. copy the whole script into *.sh form (ex. nano
      then make it executable by this command (chmod +x ./
      Nore: all above should do it with your steam user (not root) then all of permission of the file and executable would belong to the steam user.

    1. For first time ruuning the problem is the latestinstalledupdate.txt still not yet exist and the comman will not if it does (so you need to add that file manually before running at the first time at your $SERVERDIR directory and input some vale there that less than the value of latestavailableupdate.txt (ex : if the value of latestavailableupdate.txt is 749134 then the value of latestinstalledupdate.txt should be something like 749000 ) to tell the script condition that your ark version is now less than the current available version then the the condition will be true and continue…. as the below script said :

      LATESTUPDATE=`cat $SERVERDIR/latestavailableupdate.txt`
      INSTALLEDUPDATE=`cat $SERVERDIR/latestinstalledupdate.txt`

      if [ “$LATESTUPDATE” != “$INSTALLEDUPDATE” ] && [ “$LATESTUPDATE” != “” ] && [ “$INSTALLEDUPDATE” != “” ]

      the script said that IF ( the value in latestavailableupdate.txt not same as latestinstalledupdate.txt ) and ( the value in latestinstalledupdate.txt must not empty )
      then the below script for update will continue working
      therefore if your latestinstalledupdate.txt don’t have any value please type any number in first line before running it then after it done updating it will automatic re-write with the correct version number.

  8. Trying to get the script to work before scheduling it with Cron. I set -xv after #!/bin/bash to echo the output, but when I run the script it just prints all of its content to the console (instead of actually executing anything).

    Not sure how to debug it to figure out where it’s going wrong, any help appreciated (and apologies for probably doing something stupid that’s causing the issue).

    1. Seems like it was a combination of “latestinstalledupdate.txt” missing (per Cha.’s comment), and for some reason “updateinprogress.dat” was still around so deleting that allowed the script to run. Seems to work now!

  9. Still getting “delimiter must be a single character” regardless if i leave it default formatted, or change it to cut -d’ ‘ -f3.

    Script will not run.

    Debian 8 64-bit.

  10. Just put single quote around the backslash in the cut :
    steampvp@ steamCmd]$ ./ +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
    cut: the delimiter must be a single character
    Try ‘cut –help’ for more information.
    [steampvp@ steamCmd]$ ./ +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
    buildid 803770

Leave a Reply

  • Deutsch
  • Русский
  • Svenska
  • 中文 (中国)
  • Español
  • Português
  • Français

Featured Articles