Skip to content

Commit 3067394

Browse files
committed
fix
1 parent 322f7de commit 3067394

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

addons/elasticsearch/dataprotection/backup.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@ toolConfig=/etc/datasafed/datasafed.conf
1111
REPOSITORY=kb-backup
1212
ES_ENDPOINT=http://${DP_DB_HOST}.${KB_NAMESPACE}.svc.cluster.local:9200
1313

14+
# if the script exits with a non-zero exit code, touch a file to indicate that the backup failed,
15+
# the sync progress container will check this file and exit if it exists
16+
function handle_exit() {
17+
exit_code=$?
18+
if [ $exit_code -ne 0 ]; then
19+
echo "failed with exit code $exit_code"
20+
touch "${DP_BACKUP_INFO_FILE}.exit"
21+
exit 1
22+
else
23+
echo "{}" >"${DP_BACKUP_INFO_FILE}"
24+
exit 0
25+
fi
26+
}
1427
trap handle_exit EXIT
1528

1629
function getToolConfigValue() {

0 commit comments

Comments
 (0)