Minor reworks to how script is structured for better efficiency
This commit is contained in:
parent
f3520c10ae
commit
c9984c448c
@ -2,5 +2,4 @@
|
||||
exec nice -n 10 restic \
|
||||
-r "s3:{{ backup_s3_aws_endpoint_url }}/{{ backup_s3_bucket }}/restic" \
|
||||
-p /opt/restic-password \
|
||||
--verbose \
|
||||
"$@"
|
||||
|
@ -48,16 +48,18 @@ fi
|
||||
# Helper functions
|
||||
backup() {
|
||||
# Takes a file or directory to backup and backs it up
|
||||
[ -z "$1" ] && return 1
|
||||
|
||||
dir="$1"
|
||||
echo "- $dir"
|
||||
[ -z "$@" ] && return 1
|
||||
|
||||
if command -v restic > /dev/null 2>&1; then
|
||||
for dir in "$@"; do
|
||||
echo "- $dir"
|
||||
done
|
||||
/opt/restic-wrapper \
|
||||
backup \
|
||||
"$dir"
|
||||
"$@"
|
||||
else
|
||||
dir="$@"
|
||||
echo "- $dir"
|
||||
nice -n 10 tar {{ backup_s3backup_tar_args }}{{ backup_s3backup_tar_args_extra }} \
|
||||
{% for item in backup_s3backup_exclude_list + backup_s3backup_exclude_list_extra %}
|
||||
--exclude "{{ item }}" \
|
||||
@ -88,6 +90,9 @@ if [ -n "${DIRS[*]}" ]; then
|
||||
echo "- {{ item }}"
|
||||
{% endfor %}
|
||||
echo "Will upload resultant backups to {{ backup_s3_bucket }}"
|
||||
if command -v restic > /dev/null 2>&1; then
|
||||
backup ${DIRS[*]}
|
||||
else
|
||||
for dir in "${DIRS[@]}"; do
|
||||
if [ "$dir" == "/data" ]; then
|
||||
for datadir in "$dir"/*; do
|
||||
@ -98,6 +103,7 @@ if [ -n "${DIRS[*]}" ]; then
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
# Dump Postgres DBs, if possible
|
||||
if command -v psql > /dev/null 2>&1; then
|
||||
|
Loading…
x
Reference in New Issue
Block a user