Only use restic for backups from now on
This commit is contained in:
parent
7f75bdb5cd
commit
e6e8427227
@ -40,7 +40,6 @@ backup() {
|
|||||||
# Takes a file or directory to backup and backs it up
|
# Takes a file or directory to backup and backs it up
|
||||||
[ -z "$*" ] && return 1
|
[ -z "$*" ] && return 1
|
||||||
|
|
||||||
if command -v restic > /dev/null 2>&1; then
|
|
||||||
for dir in "$@"; do
|
for dir in "$@"; do
|
||||||
echo "- $dir"
|
echo "- $dir"
|
||||||
done
|
done
|
||||||
@ -59,9 +58,9 @@ backup() {
|
|||||||
# we can script around it.
|
# we can script around it.
|
||||||
/opt/restic-wrapper \
|
/opt/restic-wrapper \
|
||||||
--verbose \
|
--verbose \
|
||||||
{% for item in backup_s3backup_exclude_list + backup_s3backup_exclude_list_extra %}
|
{% for item in backup_s3backup_exclude_list + backup_s3backup_exclude_list_extra %}
|
||||||
--exclude="{{ item }}" \
|
--exclude="{{ item }}" \
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
--exclude="/data/**/backup" \
|
--exclude="/data/**/backup" \
|
||||||
--exclude="/data/**/backups" \
|
--exclude="/data/**/backups" \
|
||||||
--exclude="*.bak" \
|
--exclude="*.bak" \
|
||||||
@ -87,20 +86,6 @@ backup() {
|
|||||||
--keep-tag noremove \
|
--keep-tag noremove \
|
||||||
--host "$HOSTNAME" \
|
--host "$HOSTNAME" \
|
||||||
--prune
|
--prune
|
||||||
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 }}" \
|
|
||||||
{% endfor %}
|
|
||||||
"$dir" \
|
|
||||||
| aws s3 cp --expected-size 274877906944 - \
|
|
||||||
{% if backup_s3_aws_endpoint_url is defined %}
|
|
||||||
--endpoint-url="{{ backup_s3_aws_endpoint_url }}" \
|
|
||||||
{% endif %}
|
|
||||||
"s3://{{ backup_s3_bucket }}/$HOSTNAME/$dir/$(date "+{{ backup_dateformat }}").tar.gz"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Dump Postgres DBs, if possible
|
# Dump Postgres DBs, if possible
|
||||||
@ -142,19 +127,5 @@ if [ -n "${DIRS[*]}" ]; then
|
|||||||
echo "- {{ item }}"
|
echo "- {{ item }}"
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
echo "Will upload resultant backups to {{ backup_s3_bucket }}"
|
echo "Will upload resultant backups to {{ backup_s3_bucket }}"
|
||||||
if command -v restic > /dev/null 2>&1; then
|
|
||||||
echo "Using restic for backups"
|
|
||||||
backup ${DIRS[*]}
|
backup ${DIRS[*]}
|
||||||
else
|
|
||||||
echo "Using rudimentary tar and S3 for backups"
|
|
||||||
for dir in "${DIRS[@]}"; do
|
|
||||||
if [ "$dir" == "/data" ]; then
|
|
||||||
for datadir in "$dir"/*; do
|
|
||||||
[ -e "$datadir" ] && backup "$datadir"
|
|
||||||
done
|
|
||||||
else
|
|
||||||
backup "$dir"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user