Skip to content

Commit 425916c

Browse files
[fix] Fixed pgrep returning multiple process IDs #157
Fixes #157
1 parent 06be32d commit 425916c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

openwisp-monitoring/files/monitoring.agent

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ save_data() {
109109
-p daemon.info
110110
fi
111111
# get process id of the process sending data
112-
pid=$(pgrep -f "openwisp-monitoring.*--mode send")
112+
pid=$(pgrep -P 1 -f "openwisp-monitoring.*--mode send")
113113
kill -SIGUSR1 "$pid"
114114
sleep "$INTERVAL"
115115
done
@@ -210,7 +210,7 @@ send_data() {
210210
-t openwisp-monitoring \
211211
-p daemon.err
212212
# get process id of the process collecting data
213-
pid=$(pgrep -f "openwisp-monitoring.*--mode collect")
213+
pid=$(pgrep -P 1 -f "openwisp-monitoring.*--mode collect")
214214
kill -SIGKILL "$pid"
215215
exit 2
216216
fi

0 commit comments

Comments
 (0)