add "rcctl ls rogue", to show daemons which are running but not set as
authorsthen <sthen@openbsd.org>
Sat, 23 Oct 2021 08:19:27 +0000 (08:19 +0000)
committersthen <sthen@openbsd.org>
Sat, 23 Oct 2021 08:19:27 +0000 (08:19 +0000)
"enabled" in rc.conf.local.

naming suggesting from schwarze@, ok kn@ ajacoutot@

usr.sbin/rcctl/rcctl.8
usr.sbin/rcctl/rcctl.sh

index b84ea04..6c3048b 100644 (file)
@@ -1,4 +1,4 @@
-.\"    $OpenBSD: rcctl.8,v 1.37 2021/06/26 18:02:48 jmc Exp $
+.\"    $OpenBSD: rcctl.8,v 1.38 2021/10/23 08:19:27 sthen Exp $
 .\"
 .\" Copyright (c) 2014 Antoine Jacoutot <ajacoutot@openbsd.org>
 .\"
@@ -14,7 +14,7 @@
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd $Mdocdate: June 26 2021 $
+.Dd $Mdocdate: October 23 2021 $
 .Dt RCCTL 8
 .Os
 .Sh NAME
@@ -36,7 +36,7 @@
 .Nm rcctl
 .Cm ls
 .Sm off
-.Cm all | failed | on | off | started | stopped
+.Cm all | failed | on | off | rogue | started | stopped
 .Sm on
 .Sh DESCRIPTION
 The
@@ -123,6 +123,8 @@ enabled but stopped daemons
 disabled services and daemons
 .It Cm on
 enabled services and daemons
+.It Cm rogue
+daemons which are disabled but currently running
 .It Cm started
 running daemons
 .It Cm stopped
index 699737f..ec1e478 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/ksh
 #
-# $OpenBSD: rcctl.sh,v 1.110 2021/02/27 09:28:04 ajacoutot Exp $
+# $OpenBSD: rcctl.sh,v 1.111 2021/10/23 08:19:27 sthen Exp $
 #
 # Copyright (c) 2014, 2015-2021 Antoine Jacoutot <ajacoutot@openbsd.org>
 # Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -35,7 +35,7 @@ usage()
        "usage: rcctl get|getdef|set service | daemon [variable [arguments]]
        rcctl [-df] ${_a} daemon ...
        rcctl disable|enable|order [daemon ...]
-       rcctl ls all|failed|off|on|started|stopped"
+       rcctl ls all|failed|off|on|rogue|started|stopped"
 }
 
 needs_root()
@@ -228,6 +228,13 @@ svc_ls()
                                unset _on
                        done
                        ;;
+               rogue)
+                       for _svc in $(svc_ls off); do
+                               ! svc_is_special ${_svc} && \
+                                       /etc/rc.d/${_svc} check >/dev/null && \
+                                       echo ${_svc} && _ret=1
+                       done
+                       ;;
                started|stopped)
                        for _svc in $(ls_rcscripts); do
                                /etc/rc.d/${_svc} check >/dev/null && _started=1
@@ -502,7 +509,7 @@ ret=0
 case ${action} in
        ls)
                lsarg=$2
-               [[ ${lsarg} == @(all|failed|off|on|started|stopped) ]] || usage
+               [[ ${lsarg} == @(all|failed|off|on|rogue|started|stopped) ]] || usage
                ;;
        order)
                shift 1