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 a93a094 commit cd19187Copy full SHA for cd19187
bin/v-list-sys-services
@@ -23,9 +23,16 @@ get_srv_state() {
23
proc_name=${2-$1}
24
25
# Check service status
26
- status=$(service $srv status 2>/dev/null)
27
- rc=$?
28
- stopped=$(echo $status| grep stop)
+
+ # Check if systemd is used as init system
+ if [[ $(systemctl) =~ -\.mount ]]; then
29
+ $(systemctl -q is-active $srv)
30
+ rc=$?
31
+ else
32
+ status=$(service $srv status 2>/dev/null)
33
34
+ stopped=$(echo $status| grep stop)
35
+ fi
36
37
if [ "$rc" -eq 0 ] && [ -z "$stopped" ]; then
38
state='running'
0 commit comments