add --allmaps and --autobackups to backup command

This commit is contained in:
MrSlimbrowser 2020-02-11 21:27:23 +01:00
parent c116e12b2a
commit 0b59dfd67d

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[@]}"