From c91a9b26e61c85e9250d928c383859305b65504e Mon Sep 17 00:00:00 2001 From: sthen Date: Sat, 23 Oct 2021 08:19:27 +0000 Subject: [PATCH] add "rcctl ls rogue", to show daemons which are running but not set as "enabled" in rc.conf.local. naming suggesting from schwarze@, ok kn@ ajacoutot@ --- usr.sbin/rcctl/rcctl.8 | 8 +++++--- usr.sbin/rcctl/rcctl.sh | 13 ++++++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/usr.sbin/rcctl/rcctl.8 b/usr.sbin/rcctl/rcctl.8 index b84ea04a479..6c3048b834c 100644 --- a/usr.sbin/rcctl/rcctl.8 +++ b/usr.sbin/rcctl/rcctl.8 @@ -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 .\" @@ -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 diff --git a/usr.sbin/rcctl/rcctl.sh b/usr.sbin/rcctl/rcctl.sh index 699737ff6cc..ec1e478fad1 100644 --- a/usr.sbin/rcctl/rcctl.sh +++ b/usr.sbin/rcctl/rcctl.sh @@ -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 # Copyright (c) 2014 Ingo Schwarze @@ -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 -- 2.20.1