Use APPS_DATA_DIR in app backup and restore scripts
This commit is contained in:
@@ -12,7 +12,7 @@ if [[ $# == 1 && "$1" == "--check" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
readonly DATA_DIR="${HOME}/data"
|
||||
readonly APPS_DATA_DIR="${HOME}/appsdata"
|
||||
|
||||
# verify argument count
|
||||
if [[ "$1" == "s3" && $# -lt 9 ]]; then
|
||||
@@ -51,8 +51,8 @@ fi
|
||||
|
||||
# perform backup
|
||||
readonly now=$(date "+%Y-%m-%d-%H%M%S")
|
||||
readonly app_data_dir="${DATA_DIR}/${app_id}"
|
||||
readonly app_data_snapshot="${DATA_DIR}/snapshots/${app_id}-${now}"
|
||||
readonly app_data_dir="${APPS_DATA_DIR}/${app_id}"
|
||||
readonly app_data_snapshot="${APPS_DATA_DIR}/snapshots/${app_id}-${now}"
|
||||
|
||||
btrfs subvolume snapshot -r "${app_data_dir}" "${app_data_snapshot}"
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ if [ $# -lt 3 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
readonly DATA_DIR="${HOME}/data"
|
||||
readonly APPS_DATA_DIR="${HOME}/appsdata"
|
||||
readonly curl="curl --fail --connect-timeout 20 --retry 10 --retry-delay 2 --max-time 2400"
|
||||
|
||||
app_id="$1"
|
||||
@@ -33,8 +33,8 @@ for try in `seq 1 5`; do
|
||||
|
||||
if $curl -L "${restore_url}" \
|
||||
| openssl aes-256-cbc -d -pass "pass:${restore_key}" \
|
||||
| tar -zxf - -C "${DATA_DIR}/${app_id}" 2>"${error_log}"; then
|
||||
chown -R yellowtent:yellowtent "${DATA_DIR}/${app_id}"
|
||||
| tar -zxf - -C "${APPS_DATA_DIR}/${app_id}" 2>"${error_log}"; then
|
||||
chown -R yellowtent:yellowtent "${APPS_DATA_DIR}/${app_id}"
|
||||
break
|
||||
fi
|
||||
cat "${error_log}" && rm "${error_log}"
|
||||
@@ -46,4 +46,3 @@ if [[ ${try} -eq 5 ]]; then
|
||||
else
|
||||
echo "restore successful"
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user