summaryrefslogtreecommitdiff
path: root/doalogwatch.in
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2024-04-15 13:39:35 +0200
committerErich Eckner <git@eckner.net>2024-04-15 13:41:32 +0200
commitbb677951f55b884d53ebd0ae52d3d3760aabca78 (patch)
treea80e41b414bbea48edcfaedeceef3c2fd6c1a693 /doalogwatch.in
parent22633a3ac11687380977fd8de43bbae4aea6e8fb (diff)
downloadlogwatch-extra-bb677951f55b884d53ebd0ae52d3d3760aabca78.tar.xz
doalogwatch: only check backups if not called by shutdownasap -q
* shutdownasap -q does its own check - do not wait again for the backups
Diffstat (limited to 'doalogwatch.in')
-rwxr-xr-xdoalogwatch.in23
1 files changed, 13 insertions, 10 deletions
diff --git a/doalogwatch.in b/doalogwatch.in
index 1b0c662..f3b312d 100755
--- a/doalogwatch.in
+++ b/doalogwatch.in
@@ -50,17 +50,20 @@ while ${warten} && [ "$(date '+%H')" != '23' ]; do
warten=true
# check for currently running backups
- pgrep -xf "(#BINDIR#/)?backup( .*)?" >/dev/null && \
- warten=true
- if [ -r '#ETCDIR#/backup.conf' ]; then
- for i in 1 2; do
- for id in "${!backups[@]}"; do
- [ -s "#TMPDIR#/${id}.pid" ] && \
- kill -0 $(cat "#TMPDIR#/${id}.pid") 2>/dev/null && \
- warten=true
+ ppid=$(awk '$1 == "PPid:" {print $2}' /proc/$$/status)
+ if [ ! "$(tr '\0' ' ' <"/proc/${ppid}/cmdline")" = '/bin/bash /usr/bin/shutdownasap -q ' ]; then
+ pgrep -xf "(#BINDIR#/)?backup( .*)?" >/dev/null && \
+ warten=true
+ if [ -r '#ETCDIR#/backup.conf' ]; then
+ for i in 1 2; do
+ for id in "${!backups[@]}"; do
+ [ -s "#TMPDIR#/${id}.pid" ] && \
+ kill -0 $(cat "#TMPDIR#/${id}.pid") 2>/dev/null && \
+ warten=true
+ done
+ sleep 1
done
- sleep 1
- done
+ fi
fi
done