Merge pull request #1059 from MrSlimbrowser/backupAllMaps

Add --allmaps and --autobackups to backup command
This commit is contained in:
Ben Peddell 2020-02-14 01:59:44 +10:00 committed by GitHub
commit 092b92e1dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2839,6 +2839,17 @@ doBackup(){
mkdir -p "$backupdir"
mkdir -p "$backupdirdaily"
for arg in "$@"; do
case "$arg" in
--allmaps) backupAllMaps=true; ;;
--autobackups) includeAutoBackups=true; ;;
*)
echo "Unrecognized option $arg"
echo "Try 'arkmanager -h' or 'arkmanager --help' for more information."
exit 1
esac
done
if [[ -z "$savedir" ]]; then
return 1
fi
@ -2880,13 +2891,24 @@ doBackup(){
fi
# Copy other world files
if [ -n "$backupAllMaps" ]; then
if [ "$backupAllMaps" == "true" ]; then
echo -e "${NORMAL} Copying other ARK world files"
for f in "${savedir}/"*.ark; do
if [[ "${f}" != "${mapfile}" && "${f}" != "${savedir}/"*_??.??.????_??.??.??.ark ]]; then
cp -p "${f}" "${backupdir}/${f##*/}"
fi
done
fi
# Copy map autobackups
if [ "$includeAutoBackups" == "true" ]; then
echo -e "${NORMAL} Copying all ARK world autobackup files"
for f in "${savedir}/"*.ark; do
if [[ "${f}" == "${savedir}/"*_??.??.????_??.??.??.ark ]]; then
cp -p "${f}" "${backupdir}/${f##*/}"
fi
done
fi
# ARK server uses Lock-Truncate-Write-Unlock
# Unfortunately we can't lock the file, as
@ -3737,7 +3759,7 @@ main(){
listMods
;;
backup)
doBackup
doBackup "${options[@]}"
;;
broadcast)
doBroadcast "${args[@]}"