mirror of
https://github.com/myvesta/vesta
synced 2025-08-14 18:49:21 -07:00
universal way to query service status
This commit is contained in:
parent
c81a2bf123
commit
f0c5a60849
1 changed files with 4 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue