From 9e9030a489d5b36b5ae1cf0e9df746cd814ff95e Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Thu, 24 Oct 2019 12:21:57 +0200 Subject: doalogwatch.in: `kill -0` und `pgrep` statt `ps aux | grep ...` --- doalogwatch.in | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/doalogwatch.in b/doalogwatch.in index a08b3bd..888c474 100755 --- a/doalogwatch.in +++ b/doalogwatch.in @@ -31,9 +31,7 @@ if [ -z "${services%%--service=-*}" ]; then fi [ -r "${warteAufFile}" ] && \ - ps aux | \ - awk '{print $2" "$(NF)}' | \ - grep -q "^\s*$(cat "${warteAufFile}") \(\S*/\)\?doalogwatch\$" && \ + kill -0 $(cat "${warteAufFile}") 2>/dev/null && \ exit 0 if [ -d "${warteAufFile%/*}" ]; then @@ -52,14 +50,13 @@ while ${warten}; do warten=true # check for currently running backups - ps aux | \ - grep -v "\sgrep\s" | \ - grep -q "\s\(#BINDIR#/\)\?backup\s" && \ + pgrep -x "(#BINDIR#/)?backup" >/dev/null && \ warten=true if [ -r '#ETCDIR#/backup.conf' ]; then for i in 1 2; do for id in "${!backups[@]}"; do - [ -e "#TMPDIR#/${id}.pid" ] && \ + [ -s "#TMPDIR#/${id}.pid" ] && \ + kill -0 $(cat "#TMPDIR#/${id}.pid") 2>/dev/null && \ warten=true done sleep 1 -- cgit v1.2.3-70-g09d2