Add AltSaveDirectoryName support in backup

This commit is contained in:
Ben Peddell 2015-08-15 22:25:48 +10:00
parent 544a78267d
commit 3eb123fa61
2 changed files with 12 additions and 5 deletions

View File

@ -586,6 +586,7 @@ doInstallMod(){
doBackup(){ doBackup(){
local datestamp=`date +"%Y-%m-%d_%H.%M.%S"` local datestamp=`date +"%Y-%m-%d_%H.%M.%S"`
local backupdir="${arkbackupdir}/${datestamp}" local backupdir="${arkbackupdir}/${datestamp}"
local savedir="SavedArks"
mkdir -p "$backupdir" mkdir -p "$backupdir"
# extract the map name from the active map mod # extract the map name from the active map mod
@ -602,17 +603,22 @@ doBackup(){
' <"${arkserverroot}/ShooterGame/Content/Mods/${serverMapModId}/mod.info")" ' <"${arkserverroot}/ShooterGame/Content/Mods/${serverMapModId}/mod.info")"
fi fi
# Get save directory name
if [ -n "${ark_AltSaveDirectoryName}" ]; then
savedir="${ark_AltSaveDirectoryName}"
fi
# ARK server uses Write-Unlink-Rename # ARK server uses Write-Unlink-Rename
echo -ne "${NORMAL} Copying ARK world file " echo -ne "${NORMAL} Copying ARK world file "
cp -p "${arkserverroot}/ShooterGame/Saved/SavedArks/${serverMap##*/}.ark" "${backupdir}/${serverMap##*/}.ark" cp -p "${arkserverroot}/ShooterGame/Saved/${savedir}/${serverMap##*/}.ark" "${backupdir}/${serverMap##*/}.ark"
if [ ! -f "${backupdir}/${serverMap##*/}.ark" ]; then if [ ! -f "${backupdir}/${serverMap##*/}.ark" ]; then
sleep 2 sleep 2
cp -p "${arkserverroot}/ShooterGame/Saved/SavedArks/${serverMap##*/}.ark" "${backupdir}/${serverMap##*/}.ark" cp -p "${arkserverroot}/ShooterGame/Saved/${savedir}/${serverMap##*/}.ark" "${backupdir}/${serverMap##*/}.ark"
fi fi
# If both attempts fail, server may have # If both attempts fail, server may have
# crashed between unlink and rename # crashed between unlink and rename
if [ ! -f "${backupdir}/${serverMap##*/}.ark" ]; then if [ ! -f "${backupdir}/${serverMap##*/}.ark" ]; then
cp -p "${arkserverroot}/ShooterGame/Saved/SavedArks/${serverMap##*/}.tmp" "${backupdir##*/}/${serverMap##*/}.ark" cp -p "${arkserverroot}/ShooterGame/Saved/${savedir}/${serverMap##*/}.tmp" "${backupdir##*/}/${serverMap##*/}.ark"
fi fi
if [ -f "${backupdir}/${serverMap##*/}.ark" ]; then if [ -f "${backupdir}/${serverMap##*/}.ark" ]; then
echo -e "${NORMAL}[ ${GREEN}OK${NORMAL} ]" echo -e "${NORMAL}[ ${GREEN}OK${NORMAL} ]"
@ -625,7 +631,7 @@ doBackup(){
# ARK server uses a non-blocking lock and will # ARK server uses a non-blocking lock and will
# fail to update the file if the lock fails. # fail to update the file if the lock fails.
echo -e "${NORMAL} Copying ARK profile files" echo -e "${NORMAL} Copying ARK profile files"
for f in "${arkserverroot}/ShooterGame/Saved/SavedArks/"*.arkprofile; do for f in "${arkserverroot}/ShooterGame/Saved/${savedir}/"*.arkprofile; do
echo -ne "${NORMAL} ${f##*/} " echo -ne "${NORMAL} ${f##*/} "
cp -p "${f}" "${backupdir}/${f##*/}" cp -p "${f}" "${backupdir}/${f##*/}"
if [ ! -s "${backupdir}/${f##*/}" ]; then if [ ! -s "${backupdir}/${f##*/}" ]; then
@ -646,7 +652,7 @@ doBackup(){
# ARK server uses Lock-Truncate-Write-Unlock # ARK server uses Lock-Truncate-Write-Unlock
echo -e "${NORMAL} Copying ARK tribe files " echo -e "${NORMAL} Copying ARK tribe files "
for f in "${arkserverroot}/ShooterGame/Saved/SavedArks/"*.arktribe; do for f in "${arkserverroot}/ShooterGame/Saved/${savedir}/"*.arktribe; do
echo -ne "${NORMAL} ${f##*/} " echo -ne "${NORMAL} ${f##*/} "
cp -p "${f}" "${backupdir}/${f##*/}" cp -p "${f}" "${backupdir}/${f##*/}"
if [ ! -s "${backupdir}/${f##*/}" ]; then if [ ! -s "${backupdir}/${f##*/}" ]; then

View File

@ -26,6 +26,7 @@ ark_ServerPassword="" # ARK server
ark_ServerAdminPassword="keyboardcat" # ARK server admin password, KEEP IT SAFE! ark_ServerAdminPassword="keyboardcat" # ARK server admin password, KEEP IT SAFE!
ark_MaxPlayers="70" ark_MaxPlayers="70"
#ark_GameModIds="487516323,487516324,487516325" # Uncomment to specify additional mods by Mod Id separated by commas #ark_GameModIds="487516323,487516324,487516325" # Uncomment to specify additional mods by Mod Id separated by commas
#ark_AltSaveDirectoryName="SotF" # Uncomment to specify a different save directory name
# ARK server flags - use arkflag_<optionname>=true # ARK server flags - use arkflag_<optionname>=true
#arkflag_OnlyAdminRejoinAsSpectator=true # Uncomment to only allow admins to rejoin as spectator #arkflag_OnlyAdminRejoinAsSpectator=true # Uncomment to only allow admins to rejoin as spectator