mirror of
https://github.com/myvesta/vesta
synced 2025-08-20 21:34:12 -07:00
Adds systemd compatible service status check. Closes #247.
This commit is contained in:
parent
a93a094471
commit
cd19187fc5
1 changed files with 10 additions and 3 deletions
|
@ -23,9 +23,16 @@ get_srv_state() {
|
|||
proc_name=${2-$1}
|
||||
|
||||
# Check service status
|
||||
|
||||
# Check if systemd is used as init system
|
||||
if [[ $(systemctl) =~ -\.mount ]]; then
|
||||
$(systemctl -q is-active $srv)
|
||||
rc=$?
|
||||
else
|
||||
status=$(service $srv status 2>/dev/null)
|
||||
rc=$?
|
||||
stopped=$(echo $status| grep stop)
|
||||
fi
|
||||
|
||||
if [ "$rc" -eq 0 ] && [ -z "$stopped" ]; then
|
||||
state='running'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue