diff --git a/bin/v-list-sys-services b/bin/v-list-sys-services index 7bed1437..c73742b6 100755 --- a/bin/v-list-sys-services +++ b/bin/v-list-sys-services @@ -23,12 +23,11 @@ get_srv_state() { proc_name=${2-$1} # Check service status - status=1 - if [ ! -z "$(service $srv status| grep running)" ]; then - status=0 - fi + status=$(service $srv status 2>/dev/null) + rc=$? + stopped=$(echo $status| grep stop) - if [ $status -eq 0 ]; then + if [ "$rc" -eq 0 ] && [ -z "$stopped" ]; then state='running' # Calculate cpu and memory usage