summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-10-24 12:21:57 +0200
committerErich Eckner <git@eckner.net>2019-10-24 12:21:57 +0200
commit9e9030a489d5b36b5ae1cf0e9df746cd814ff95e (patch)
tree6e99d40ebc4af1b62c5a25629f2179affe9b7f67
parentad3df326671c751eb407d4d6c75aaff295a6be3c (diff)
downloadlogwatch-extra-9e9030a489d5b36b5ae1cf0e9df746cd814ff95e.tar.xz
doalogwatch.in: `kill -0` und `pgrep` statt `ps aux | grep ...`
-rwxr-xr-xdoalogwatch.in11
1 files 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