Concatenate JINJA for loops, echo back ignored directories in backup script
This commit is contained in:
parent
eb97eb4a7a
commit
1933ba21c0
@ -26,11 +26,7 @@ set -e
|
|||||||
# We use a bash array because it affords us some level of sanitization, enough
|
# We use a bash array because it affords us some level of sanitization, enough
|
||||||
# to let us back up items whose paths contain spaces
|
# to let us back up items whose paths contain spaces
|
||||||
declare -a DIRS
|
declare -a DIRS
|
||||||
{% for item in backup_s3backup_list %}
|
{% for item in backup_s3backup_list + backup_s3backup_list_extra %}
|
||||||
DIRS+=("{{ item }}")
|
|
||||||
{% endfor %}
|
|
||||||
# Extra, probably host-specific directories
|
|
||||||
{% for item in backup_s3backup_list_extra %}
|
|
||||||
DIRS+=("{{ item }}")
|
DIRS+=("{{ item }}")
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
# End directories
|
# End directories
|
||||||
@ -50,12 +46,13 @@ echo "Commencing backup on the following items:"
|
|||||||
for dir in "${DIRS[@]}"; do
|
for dir in "${DIRS[@]}"; do
|
||||||
echo "- $dir"
|
echo "- $dir"
|
||||||
done
|
done
|
||||||
|
echo "Will ignore the following items:"
|
||||||
|
{% for item in backup_s3backup_exclude_list + backup_s3backup_exclude_list_extra %}
|
||||||
|
echo "- {{ item }}"
|
||||||
|
{% endfor %}
|
||||||
echo "Will upload resultant backup to {{ backup_s3_bucket }}"
|
echo "Will upload resultant backup to {{ backup_s3_bucket }}"
|
||||||
nice -n 10 tar {{ backup_s3backup_tar_args }}{{ backup_s3backup_tar_args_extra }} "${DIRS[@]}" \
|
nice -n 10 tar {{ backup_s3backup_tar_args }}{{ backup_s3backup_tar_args_extra }} "${DIRS[@]}" \
|
||||||
{% for item in backup_s3backup_exclude_list %}
|
{% for item in backup_s3backup_exclude_list + backup_s3backup_exclude_list_extra %}
|
||||||
--exclude "{{ item }}" \
|
|
||||||
{% endfor %}
|
|
||||||
{% for item in backup_s3backup_exclude_list_extra %}
|
|
||||||
--exclude "{{ item }}" \
|
--exclude "{{ item }}" \
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
| aws s3 cp - \
|
| aws s3 cp - \
|
||||||
|
Loading…
Reference in New Issue
Block a user