We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c2472a5 commit 3eb4c8bCopy full SHA for 3eb4c8b
bin/v-list-sys-services
@@ -91,8 +91,10 @@ get_srv_state() {
91
else
92
pids=$(pidof -x $name | tr ' ' '|')
93
fi
94
+ used_pgrep=0
95
if [ -z "$pids" ] && [ "$name" != 'nginx' ]; then
96
pids=$(pgrep $name | tr '\n' '|')
97
+ used_pgrep=1
98
99
100
# Correctly handle hestia-web-terminal service
@@ -107,7 +109,11 @@ get_srv_state() {
107
109
108
110
# Checking pid
111
if [ -n "$pids" ]; then
- pid=$(echo "$pids" | awk -F '|' '{print $NF}')
112
+ if [[ "$used_pgrep" -eq 1 ]]; then
113
+ pid=$(echo "$pids" | awk -F '|' '{print $1}')
114
+ else
115
+ pid=$(echo "$pids" | awk -F '|' '{print $NF}')
116
+ fi
117
pids=${pids%|}
118
pids=$(egrep "$pids" $tmp_file)
119
0 commit comments