Browse Source

Avoid warning using pgrep if service name has 15 or more characters (#4851)

* Avoid warning using pgrep if service name has 15 or more characters

* Update v-list-sys-services

fix prettier

* Fix linting

* Fix prettier

* Fix linting again

---------

Co-authored-by: Jaap Marcus <[email protected]>
sahsanu 1 year ago
parent
commit
04984d6471
1 changed files with 5 additions and 1 deletions
  1. 5 1
      bin/v-list-sys-services

+ 5 - 1
bin/v-list-sys-services

@@ -93,7 +93,11 @@ get_srv_state() {
 	fi
 	used_pgrep=0
 	if [ -z "$pids" ] && [ "$name" != 'nginx' ]; then
-		pids=$(pgrep $name | tr '\n' '|')
+		if [[ ${#name} -ge 15 ]]; then
+			pids=$(pgrep -f $name | tr '\n' '|')
+		else
+			pids=$(pgrep $name | tr '\n' '|')
+		fi
 		used_pgrep=1
 	fi