ARK: Survival Evolved

ARK: Survival Evolved

View Stats:
DaVijin Jul 14, 2015 @ 7:04am
Linux Dedicated Server Backup Script
Hey all...

I wrote this script to backup our Ark server running on Ubuntu 14.04... maybe some of you will find it useful.

It ZIPs the saved files, updates the server, restarts the server in a GNUScreen (using a seperate sh start script) and then uploads the ZIP backup to an FTP site of your choice.


-------------copy script into a arkbackup.sh from below this line, save it and chmod +x to it.-----------


#!/bin/sh
# ------------------------------------------------------------------
# nAvTV Ark Survival Evolved world backup and update by Beetle001
# ------------------------------------------------------------------
#
# We're going to do a backup, then update the Ark Survival Evolved Linux Dedicated server.
#
# First we need to define some variables. You'll want to edit some of these.
#
# Let's start with the FTP server.
FTPD="/"
FTPU="FTP USERNAME"
FTPP="FTP PASSWORD"
FTPS="FTP SERVER ADDRESS"
#
# Now some system binaries...
TAR="$(which tar)"
GZIP="$(which gzip)"
FTP="$(which ftp)"
ZIP="$(which zip)"
#
# Just to make the backup a bit neater, we'll add the date to the archive...
DATE=$(date +%Y%m%d)
#
# Lastly, we need to set our Backup folder, Ark folder and World Saved folder...
#
ARKBINARY=ROOT INSTALL DIR
ARKSAVE=ROOT INSTALL DIR/ShooterGame/Saved
BACKUPFOLDER=TEMP DIR TO STORE BACKUP
STEAMCMD=LOCATION OF STEAMCMD
#
# Cool, we're ready to start!
#
#
# ------------------Don't edit below this line ---------------------
#
# Remind the user that the Ark server must be stopped.
#
echo "Hi! Before you continue, please remember to close the Ark Server process."
#
# First step is to TAR our Saved files.
#
echo "Creating backup file..."
mkdir $BACKUPFOLDER
$ZIP -r $BACKUPFOLDER/ArkSave-$DATE.zip $ARKSAVE
#
# That's the backup made.
# Before we upload it to the FTP, let's update and restart the Ark server in a screen session so our players don't have to wait for us to upload the backup.
#
echo "Starting the update now..."
$STEAMCMD/steamcmd.sh +login anonymous +force_install_dir $ARKBINARY +app_update 376030 validate +quit
#
echo "Restarting Ark server..."
ulimit -n 1000000
screen -S ArkServer -d -m ./arkstart.sh
#
# Now we can upload our backup!
#
echo "Uploading Backup file to FTP..."
cd $BACKUPFOLDER
$FTP -in $FTPS <<END_SCRIPT
quote USER $FTPU
quote PASS $FTPP
cd $FTPD
mput ArkSave-$DATE.zip
bye
END_SCRIPT
echo "Backup finished and transferred!"
echo "All done!"
# Job done!
exit


----------------make a new file called arkstart.sh in the same folder as the arkupdate.sh script you just made above. Remember to chmod +x it!-----------


#!/bin/bash
ulimit -n 1000000
/home/arkserver/ark/ShooterGame/Binaries/Linux/ShooterGameServer "TheIsland?listen?Port=27015?QueryPort=27016?SessionName=CHANGE_ME?RCONEnabled=True?RCONPort=32330" -server -log


----------------------------------------------------------------------------------------------------------------------------------
(set your binary switches to whatever you need t)

Date Posted: Jul 14, 2015 @ 7:04am
Posts: 0