Utility scripts for a TES3MP server administrator.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

38 lines
1.4 KiB

#!/bin/bash
set -e
set -x
_name="${1}"
test -z "${_name}" && _name="tes3mp-backup"
right_now=$(date +%F)-$(date +%T)
tes3mp_dir=$(realpath $(dirname ${0}))/..
backup_dir=${tes3mp_dir}/../backups/${_name}/${right_now}
backup_data_dir=${backup_dir}/CoreScripts/data/custom
backup_data_base_dir=${backup_dir}/CoreScripts/data
backup_player_dir=${backup_dir}/CoreScripts/data/player
backup_world_dir=${backup_dir}/CoreScripts/data/world
corescripts_path=${tes3mp_dir}/lua/CoreScripts
map_path=${corescripts_path}/data/map
player_path=${corescripts_path}/data/player
recordstore_path=${corescripts_path}/data/recordstore
world_path=${corescripts_path}/data/world
real_estate_db=${corescripts_path}/data/custom/RealEstate/RealEstateOwned.json
mkdir -p ${backup_data_dir}/RealEstate ${backup_player_dir} ${backup_world_dir}
rsync -aq ${real_estate_db} ${backup_data_dir}/RealEstate/
rsync -aq ${corescripts_path}/data/custom/__config_*.json ${backup_data_dir}/
rsync -aq ${corescripts_path}/data/custom/__data_*.json ${backup_data_dir}/
test -d ${map_path} && rsync -aq ${map_path} ${backup_data_base_dir}/
test -f ${player_path}/*.json && rsync -aq ${player_path}/*.json ${backup_player_dir}/
test -d ${recordstore_path} && rsync -aq ${recordstore_path} ${backup_data_base_dir}/
rsync -aq ${world_path}/world.json ${backup_world_dir}/
echo "${right_now} (${_name}) BACKUPS DONE!"