Add arkBackupPostCommand

This commit is contained in:
Ben Peddell 2020-02-22 20:21:55 +10:00
parent fdff30450f
commit f26ae1e56f
3 changed files with 14 additions and 2 deletions

View File

@ -501,6 +501,11 @@ The following options can be overridden on a per-instance basis:
The directory in which to store backups. Can be overridden in
the instance config.
`arkBackupPostCommand`::
Command to be run using `eval` after backup completes.
`$backupfile` will be set to the full path of the backup tar.bz2 file.
e.g. `arkBackupPostCommand='aws s3 cp "$backupfile" "s3://bucket_name/backups"'`
`arkwarnminutes`::
The number of minutes over which the shutdown and update warnings
should be run

View File

@ -2836,6 +2836,7 @@ doBackup(){
local savedcfgdir="${saverootdir}/Config/LinuxServer"
local savedir="$(getSavedArksDirectory "${saverootdir}")"
local mapname="$(getServerMapName)"
local backupfile
mkdir -p "$backupdir"
mkdir -p "$backupdirdaily"
@ -3015,11 +3016,12 @@ doBackup(){
#Tar the files and remove the original Backup Directory. Saves about 50MB of disk space per backup
echo -ne "${NORMAL} Compressing Backup "
backupfile="${arkbackupdir}/${daystamp}/${instance}.${datestamp}.tar.bz2"
tar -jcf "${arkbackupdir}/${daystamp}/${instance}.${datestamp}.tar.bz2" -C "${arkbackupdir}" "${datestamp}"
tar -jcf "${backupfile}" -C "${arkbackupdir}" "${datestamp}"
rm -rf ${backupdir}
if [ -f "${arkbackupdir}/${daystamp}/${instance}.${datestamp}.tar.bz2" ]; then
if [ -f "${backupfile}" ]; then
echo -e "${NORMAL}\e[68G[ ${GREEN}OK${NORMAL} ]"
else
echo -e "${NORMAL}\e[68G[ ${RED}FAILED${NORMAL} ]"
@ -3041,6 +3043,10 @@ doBackup(){
(( sz += fsz ))
done)
fi
if [ -n "${arkPostBsckupCommand}" ] && [ -f "${backupfile}" ]; then
eval " ${arkPostBsckupCommand}"
fi
}
#

View File

@ -19,6 +19,7 @@ arkwarnminutes="60" # number of
arkautorestartfile="ShooterGame/Saved/.autorestart" # path to autorestart file
arkAutoUpdateOnStart="false" # set this to true if you want to always update before startup
arkBackupPreUpdate="false" # set this to true if you want to perform a backup before updating
# arkBackupPostCommand='aws s3 cp "$backupfile" "s3://bucket_name/backups"' # Set this if you want a command to run after performing a backup
#arkStartDelay=20 # set this to change the maximum delay between server starts - 0 or unser for no delay, will continue immediately when server is up
#defaultinstance_max=20 # Same as above, for v1.6.43 compatibility
#arkStagingDir="/home/steam/ARK-Staging" # Uncomment to enable updates to be fully downloaded before restarting the server (reduces downtime while updating)