Fixed up consul agent to completion
This commit is contained in:
parent
becbb8137e
commit
fcd51bdb03
1 changed files with 15 additions and 3 deletions
|
@ -1,15 +1,27 @@
|
|||
#!/bin/bash
|
||||
|
||||
restoreDir=/etc/restore
|
||||
consulDir="$restoreDir/consul"
|
||||
|
||||
|
||||
hook_check() {
|
||||
:
|
||||
if [[ -d "$consulDir" ]]; then
|
||||
rm -rf "$consulDir" || exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
hook_pre() {
|
||||
consul snapshot save /etc/restore/consul.snap
|
||||
hook_check
|
||||
mkdir -p "$consulDir" || exit 1
|
||||
pushd "$restoreDir" || exit 2
|
||||
|
||||
consul snapshot save "$consulDir/consul.snap"
|
||||
|
||||
popd || exit 2
|
||||
}
|
||||
|
||||
hook_post() {
|
||||
:
|
||||
rm -rf "$consulDir" || exit 1
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
|
|
Loading…
Reference in a new issue