pidof fallback for service list

This commit is contained in:
Serghey Rodin 2015-05-29 01:51:25 +03:00
commit 18ebaec857

View file

@ -31,6 +31,10 @@ get_srv_state() {
else
pids=$(pidof -x $proc_name |tr ' ' '|')
fi
if [ -z "$pids" ]; then
#fallback to pgrep
pids=$(pgrep $proc_name |tr '\n' '|')
fi
if [ ! -z "$pids" ]; then
pid=$(echo $pids|cut -f 1 -d \|)
pids=$(egrep "$pids" $tmp_file)