• 0
Jamie

Linux bash script - ark auto recovery, backup and archive script

Question

Do you have a Linux ARK server that after updating mods it wipes the map ?

Do you need a reliable backup solution?

Don't delay, use JR's backup solution today!

STOP, BEFORE YOU CONTINUE TO READ ENSURE YOU KNOW IF YOU HAVE A DEDICATED / VPS SERVER. IF YOU DO NOT KNOW WHAT THESE MEAN / ARE THEN TURN AWAY AND DONT ATTEMPT INSTALL.

No but seriously... ARK can be crap in the way it updates mods which can cause at times map wipes. This has gotten to the stage where I'm so pissed off I was very close to close down all ARK servers and say fuck this. ARK at random times on linux decides to randomly wipe the map without any trace / logs of the issue. 

I have found it seems to be any time a mod update goes through. 7x's out of 10 this can cause a wipe and there is no fix...

Apart from the recovery script I have just created which we are currently using on JR to ensure things are backed up. I'm publishing this so other ARK server owners can have a reliable backup / archive and recovery method.

I have tested this on a production environment and all is working smoothly, your experience may differ. PLEASE ENSURE YOU TEST!

 

This script does the following:

  • Creates backups of maps (dependent on cron job time of recovery.sh script)
  • Auto deletion of backups after reaching certain amount 
  • Creates a separate archive of maps (use the dailycleanarchive.sh script as a daily cron job to ensure this archive doesn't get too big)
  • Recovers to the latest backup if the script detects that your servers map file has dropped below the filesize of your latest backup - the tolerance.
  • Uses a tolerance variable to ensure that a backup doesn't auto recover if the map file gets smaller due to culling of dinos / removal of structures.
  • Kills your server to reinstall the map.

To install:

  • Ensure you are using a linux host and that you have full root access
  • Download the rar  file in this post, extract it to a folder on your server.
  • Ensure you chmod +x both files. for example chmod +x recovery.sh
  • Edit the following variables to match your server:
#ARK Recovery DIR
    arkrecover="/srv/daemon-data/ARKRecovery"
    #SERVER REF - USED FOR SVR DIR (NAME OF SERVER FOLDER GENERALLY)
    svrref="da4aaa1b-0ce9-46d2-bd60-5f599cc089ae"
    #SERVER MAP DIRECTORY
    svrdir="/srv/daemon-data/$svrref/ShooterGame/Saved/SavedArks"
    #Map filename for backup
    file="Valguero_P.ark"
    #Name of backup - will auto add y/m/d and time
    backupname="Valguero"
    #Amount of File backups in days to store at one time 
    backupamount=10
    logname="da4aaa1b.txt"
    #Add fault tolerance as variance may be produced due to normal ARK saving / culling of dinos
    #THIS IS CALCULATED IN BYTES. 15024000 = Slightly more than 15 mb. IF YOU HAVE A SMALLER MAP THIS MAY NEED TO BE EDITED TO ENSURE CORRECT RECOVERY.
    #ENSURE TOLERANCE IS SET TO LESS THAN ACTUAL MAP SIZE OTHERWISE THIS COULD CAUSE A RECOVERY.
    tolerance=15024000
  • Ensure that you set the script to kill your server before map restoration, currently the script uses a docker kill command. If you don't use docker you will need to kill your server via killing the process or using a more graceful method by removing the docker kill command in the script. This is on line 83
  • Add a start line after line 88. Please note that this isn't required for my servers as if our servers get killed they will auto start pretty rapidly. If you use pterodactyl for ark, this will not need to be added.
  • Create a cron job that will run recovery.sh every 5 - 10 minutes. This ensures that the file is been checked and that it is auto backing up, if it detects the main map file has gone below the threshold (backup filesize - tolerance) the system will auto recover the map file
  • Create a cron job that will run dailycleanarchive.sh every day at a suitable time. This file ensures your archive is cleaned up every day and you also have 7 days (configurable) of backups.

 

Please note if you change the ARKRecover directory, you will also have to update the arkrecover directory in the dailycleanarchive.sh otherwise it will not auto clean.

If you do need help integrating this script please post below I have no problem to help users. But please note I will not be helping users that do not have a dedicated or VPS server running ARK, this is a script that will not work for you. 

I or JR will not be responsible in anyway for loosing ARK maps / incorrect recovery, especially due to misconfiguration. This is a script that we use at JR and it works. We can not be held responsible if it doesn't work, it is in your own interest to test the script before using on a production environment.

If this script has helped you please donate to JR / me to ensure the continued updating of this script. https://donate.jrnetwork.net

 

Latest_Recovery.rar

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...