|
@@ -13,13 +13,9 @@ echo "Stopping '{{ container.name }}' service..." | ts >> "$LOG_FILE"
|
|
|
systemctl stop {{ container.name }}
|
|
|
echo "Service '{{ container.name }}' stopped." | ts >> "$LOG_FILE"
|
|
|
echo "Starting backup of '{{ container.name }}:{{ volume | regex_replace(':.*') }}'." | ts >> "$LOG_FILE"
|
|
|
-/usr/bin/rclone copy {{ volume | regex_replace(':.*') }}/ b2-container-data:current/{{ ansible_hostname }}/{{ container.name }}/{{ volume | regex_replace(':.*') | basename }} \
|
|
|
- --backup-dir=b2-container-data:old/{{ ansible_hostname }}/{{ container.name }}/{{ volume | regex_replace(':.*') | basename }} \
|
|
|
- --suffix=-$(date +%Y-%m-%d) \
|
|
|
- --fast-list \
|
|
|
- --suffix-keep-extension \
|
|
|
- --exclude "*log" \
|
|
|
- --log-file="$LOG_FILE" -v
|
|
|
+
|
|
|
+tar -czf /opt/backups/$(date +%Y-%m-%d)_{{ ansible_hostname }}_{{ container.name}}_{{ volume | regex_replace(':.*') | basename }}.tar.gz {{ volume | regex_replace(':.*') }}/
|
|
|
+
|
|
|
if [[ $? > 0 ]]; then
|
|
|
curl \
|
|
|
-H "Title: rclone backup error" \
|
|
@@ -37,6 +33,13 @@ echo "Service '{{ container.name }}' started." | ts >> "$LOG_FILE"
|
|
|
{% endfor %}
|
|
|
{% endif %}
|
|
|
{% endfor %}
|
|
|
+
|
|
|
+echo "Backing up tarballs to B2..." | ts >> "$LOG_FILE"
|
|
|
+/usr/bin/rclone copy /opt/backups/ b2-container-data:current/{{ ansible_hostname }} \
|
|
|
+ --fast-list \
|
|
|
+ --log-file="$LOG_FILE" -v
|
|
|
+echo "Finished backing up tarballs to B2." | ts >> "$LOG_FILE"
|
|
|
+
|
|
|
{% endif %}
|
|
|
{% endif %}
|
|
|
|