Created
December 27, 2015 10:08
-
-
Save Deshke/c2d1af2364c49d40fef0 to your computer and use it in GitHub Desktop.
update and start ark survival evolved linux server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i know dirty, but it does the job..