man dig:
The -b option sets the source IP address of the query to address.
This must be a valid address on one of the host's network interfaces
or "0.0.0.0" or "::".
Вы должны использовать pgrep process
вместо ps aux | grep process
.
Например, в настоящее время gnome-terminal
работает, поэтому
ps aux | grep gnome-terminal
user 2045 0.9 0.9 459456 36084 ? Ssl 17:33 0:00
/usr/lib/gnome-terminal/gnome-terminal-server
user 2206 0.0 0.0 12780 996 pts/0 S+ 17:33 0:00 grep
gnome-terminal
Где как
pgrep gnome-terminal
2045
В настоящее время chome не запущен, поэтому
ps aux | grep chrome
user 2212 0.0 0.0 12780 976 pts/0 S+ 17:34 0:00 grep chrome
Но pgrep chrome
ничего не вернет.
В вашем случае pgrep dockerd
будет работать.
#!/bin/bash
ps -ef | grep -q "[d]ockerd"
if [ "$?" -eq "0" ]
then
echo "dockerd is running"
else
echo "dockerd is not running"
fi