Skip to content

Instantly share code, notes, and snippets.

@Deshke
Created December 27, 2015 10:08
Show Gist options
  • Save Deshke/c2d1af2364c49d40fef0 to your computer and use it in GitHub Desktop.
Save Deshke/c2d1af2364c49d40fef0 to your computer and use it in GitHub Desktop.
update and start ark survival evolved linux server
#!/bin/bash
# nedded mcrcon (https://github.com/Tiiffi/mcrcon.git)
# update the vars, and set down below #start_server the install dir
BASE_DIR=""
STEAM_CMD="path to steamcmd.sh"
RCON_PW=""
RCON_HOST="localhost"
RCON_PORT=""
# if you dont have MCRON in your PATH get it
# https://github.com/Tiiffi/mcrcon.git
# git clone https://github.com/Tiiffi/mcrcon.git -b develop && cd mcron && make
MCRON=""
# get installed version from file
test -f ${BASE_DIR}/installed_ark.txt
if [[ $? -eq 0 ]]; then
installed_ark=$(cat ${BASE_DIR}/installed_ark.txt )
fi
# get latest ark update from steam
latest_ark=$(${BASE_DIR}/${STEAM_CMD} +login anonymous +app_info_update 1 +app_info_print 376030 +app_info_print 376030 +quit | grep "buildid" |uniq | awk '{print $2}' | tr -d \")
# check if latest not equals installed
if [[ ${installed_ark} -ne ${latest_ark} ]]; then
${MCRON} -c -H ${RCON_HOST} -P ${RCON_PORT} -p ${RCON_PW} "broadcast New update available, server is restarting in 1 minute!"
sleep 60
${MCRON} -c -H ${RCON_HOST} -P ${RCON_PORT} -p ${RCON_PW} "SaveWorld"
sleep 2
${MCRON} -c -H ${RCON_HOST} -P ${RCON_PORT} -p ${RCON_PW} "DoExit"
sleep 2
# check if server is stopped
pgrep -f ShooterGameServer
if [[ $? -eq 0 ]]; then
ark_pid=$(pgrep -f ShooterGameServer)
kill -15 ${ark_pid}
sleep 5
kill -9 ${ark_pid}
fi
# update server
${BASE_DIR}/${STEAM_CMD} +login anonymous +app_update 376030 +quit
echo ${latest_ark} > ${BASE_DIR}/installed_ark.txt
#start_server
cd "install dir Steam/steamapps/common/ARK Survival Evolved Dedicated Server/ShooterGame/"
Binaries/Linux/ShooterGameServer TheIsland?listen?bRawSockets -server -log &
else
exit 0;
fi
@Deshke
Copy link
Author

Deshke commented Dec 27, 2015

i know dirty, but it does the job..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment