fix: backup management

This commit is contained in:
Yannik Schmidt
2023-01-14 06:04:32 +01:00
parent aadc9efb86
commit fc0ac7da03
2 changed files with 33 additions and 7 deletions

View File

@@ -4,14 +4,14 @@ set -eu
mkdir -p {{ hostname_base }}
cd {{ hostname_base }}
TYPE=""
if [ -z "$1" ]; then
if [ $# -ne 0 ]; then
TYPE=$1
fi
TEST=$(python -c "int('$TYPE' in ['size_changed', 'no_high_data', 'minimal'])^1")
TEST=$(python3 -c "print(int('$TYPE' in ['size_changed', 'no_high_data', 'minimal', ''])^1)")
if [ $TEST -ne 0 ]; then
echo Bad Filter Option $1
echo Bad Filter Option [$TYPE]
exit 1
fi
dest=./
@@ -46,6 +46,14 @@ TOKEN="{{ token }}"
if [ $RSYNC_SUCCESS -eq 0 ]; then
curl -H "${CONTENT_TYPE}" -X POST "${ASYNC_ICINGA_ADDRESS}" -d \
"{\"service\": \"${SERVICE}\", \"token\": \"${TOKEN}\", \"status\": \"OK\", \"info\": \"\"}"
# if size changed was copied save new size #
{% if not size_change_commands %}
echo No Sizes to notifiy
{% endif %}
{% for cmd in size_change_commands %}
{{ cmd }}
{% endfor %}
else
curl -H "${CONTENT_TYPE}" -X POST "${ASYNC_ICINGA_ADDRESS}" -d \
"{\"service\": \"${SERVICE}\", \"token\": \"${TOKEN}\", \"status\": \"CRITICAL\", \"info\": \"\"}"