summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2020-03-30 22:37:14 +0200
committerErich Eckner <git@eckner.net>2020-03-30 22:37:14 +0200
commit7452af237b00b10c82cff0e5962357181690a912 (patch)
tree82254f08db868cd6d1b921f06dd598d76f645818
parent7244caf5f06a5984726f402763402a22d788478a (diff)
downloadshutdownasap-7452af237b00b10c82cff0e5962357181690a912.tar.xz
additionalWatchHook -> additionalWatchHookSlow, additionalWatchHookFast
-rwxr-xr-xshutdownasap.conf.in13
-rwxr-xr-xshutdownasap.in10
2 files changed, 18 insertions, 5 deletions
diff --git a/shutdownasap.conf.in b/shutdownasap.conf.in
index 7558407..d42892c 100755
--- a/shutdownasap.conf.in
+++ b/shutdownasap.conf.in
@@ -30,10 +30,9 @@ 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() {
+# This hook should return != 0, if we should keep waiting for shutdown.
+# Note, that it is queried often.
+additionalWatchHookFast() {
if command -v check-if-bareos-backup-is-running; then
if ! sudo check-if-bareos-backup-is-running; then
return 1
@@ -44,6 +43,12 @@ additionalWatchHook() {
return 0
}
+# This hook should return != 0, if we should keep waiting for shutdown.
+# Note, that it is queried seldom (e.g. once, if it returns 0).
+additionalWatchHookSlow() {
+ 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 1206fb5..146725a 100755
--- a/shutdownasap.in
+++ b/shutdownasap.in
@@ -21,7 +21,7 @@ fi
beforeWatchHook
i=1
-while [ ${i} -gt 0 ] || ! additionalWatchHook
+while [ ${i} -gt 0 ] || ! additionalWatchHookSlow
do
if [ ${i} -eq 0 ]
then
@@ -84,6 +84,14 @@ do
fi
done
+ if ! additionalWatchHookFast
+ then
+ nochwarten=true
+ if ! ${quiet}; then
+ echo "additionalWatchHookFast"
+ fi
+ fi
+
if ${nochwarten}
then
if ! ${quiet}; then