2017-06-29 06:28:48 +00:00
|
|
|
#! /bin/bash
|
|
|
|
set -e
|
|
|
|
|
2021-06-14 22:55:26 +00:00
|
|
|
restore_snapshot="$1"
|
2018-05-13 17:30:02 +00:00
|
|
|
|
2019-01-28 19:44:38 +00:00
|
|
|
# Run pre-restore scripts
|
|
|
|
for f in /scripts/restore/before/*; do
|
2021-06-14 22:55:26 +00:00
|
|
|
if [ -f "$f" ] && [ -x "$f" ]; then
|
|
|
|
bash "$f"
|
2019-01-28 19:44:38 +00:00
|
|
|
fi
|
|
|
|
done
|
2018-09-28 00:32:55 +00:00
|
|
|
|
2021-06-14 22:55:26 +00:00
|
|
|
# shellcheck disable=SC2086
|
2018-07-24 15:38:22 +00:00
|
|
|
restic \
|
2021-06-14 22:55:26 +00:00
|
|
|
-r "$BACKUP_DEST" \
|
2018-07-24 15:38:22 +00:00
|
|
|
$OPT_ARGUMENTS \
|
|
|
|
restore \
|
2021-06-14 22:55:26 +00:00
|
|
|
"$restore_snapshot" \
|
2018-07-24 15:38:22 +00:00
|
|
|
-t /
|
2018-09-28 00:32:55 +00:00
|
|
|
|
2019-01-28 19:44:38 +00:00
|
|
|
# Run post-restore scripts
|
|
|
|
for f in /scripts/restore/after/*; do
|
2021-06-14 22:55:26 +00:00
|
|
|
if [ -f "$f" ] && [ -x "$f" ]; then
|
|
|
|
bash "$f"
|
2019-01-28 19:44:38 +00:00
|
|
|
fi
|
|
|
|
done
|