diff options
-rwxr-xr-x | doalogwatch.in | 23 |
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 |