summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2020-03-18 15:06:54 +0100
committerErich Eckner <git@eckner.net>2020-03-18 15:06:54 +0100
commitd970ccb156517c9d51c494c16945c15470fa576f (patch)
tree312a6dffd8b336585fbab57dc601ddb73304b707
parent2df66f15f1fa6ff3bafc2b132bd07718ac4c25ac (diff)
downloadshutdownasap-d970ccb156517c9d51c494c16945c15470fa576f.tar.xz
additionalWatchHook() new
-rwxr-xr-xshutdownasap.conf.in14
-rwxr-xr-xshutdownasap.in6
2 files changed, 19 insertions, 1 deletions
diff --git a/shutdownasap.conf.in b/shutdownasap.conf.in
index cfd9f91..7558407 100755
--- a/shutdownasap.conf.in
+++ b/shutdownasap.conf.in
@@ -30,6 +30,20 @@ beforeWatchHook() {
true
}
+# hook to execute if we believe, the system should come down
+# If this hook returns with 0, everything is ok - if it returns with 1,
+# we should keep waiting for shutdown (and ask this hook again).
+additionalWatchHook() {
+ if command -v check-if-bareos-backup-is-running; then
+ if ! sudo check-if-bareos-backup-is-running; then
+ return 1
+ else
+ return 0
+ fi
+ fi
+ return 0
+}
+
# hook to execute before shutting down
beforeShutDownHook() {
if command -v doalogwatch >/dev/null; then
diff --git a/shutdownasap.in b/shutdownasap.in
index 328e7ba..1206fb5 100755
--- a/shutdownasap.in
+++ b/shutdownasap.in
@@ -21,8 +21,12 @@ fi
beforeWatchHook
i=1
-while [ ${i} -gt 0 ]
+while [ ${i} -gt 0 ] || ! additionalWatchHook
do
+ if [ ${i} -eq 0 ]
+ then
+ i=1
+ fi
sleep 1
prozesse="$(ps aux | grep -v grep)"