Why does pgrep not find systemd-resolved?
0
votes
1
answer
270
views
lang-bash
#!/usr/bin/env bash
echo "pgrep not finding systemd-resolved has bitten many times."
if [ -z $(pgrep systemd-resolved) ]; then
echo -e "systemd-resolved not found by pgrep, trying another way.\n";
ps aux | egrep -i '(DNS|HOST|DH|RESOLV|systemd-resolved)' | egrep -v 'grep -E';
fi;
systemd-resolved not found by pgrep, trying another way:
systemd+ **914** 0.0 0.0 26196 4048 ? Ss Nov12 0:02 /lib/systemd/**systemd-resolved**
rjt 73300 0.0 0.0 9228 2160 pts/2 S+ 23:02 0:00 grep -E --color=auto -i (DNS|HOST|DH|RESOLV|systemd-resolved)
I work on many different systems of various age. Need to know the backend name resolution system and what is covered by the name resolver. So I often use pgrep to find all dns related processes.
Appears to be a string length limit for pgrep?
Asked by rjt
(387 rep)
Nov 17, 2022, 05:24 AM
Last activity: Nov 17, 2022, 08:14 AM
Last activity: Nov 17, 2022, 08:14 AM