From nobody Wed Feb 19 22:59:19 2025 X-Original-To: questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YysKS4jpcz5npsv for ; Wed, 19 Feb 2025 22:59:40 +0000 (UTC) (envelope-from freebsd@gushi.org) Received: from prime.gushi.org (prime.gushi.org [IPv6:2620:137:6000:10::142]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature ECDSA (secp384r1) client-digest SHA384) (Client CN "prime.gushi.org", Issuer "E6" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YysKR05vGz3ZJZ for ; Wed, 19 Feb 2025 22:59:38 +0000 (UTC) (envelope-from freebsd@gushi.org) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gushi.org header.s=prime2014 header.b=LfFDXNJd; dmarc=pass (policy=none) header.from=gushi.org; spf=pass (mx1.freebsd.org: domain of freebsd@gushi.org designates 2620:137:6000:10::142 as permitted sender) smtp.mailfrom=freebsd@gushi.org Received: from smtpclient.apple ([IPv6:2601:602:400:8e7e:28d8:c721:395d:d1a9]) (authenticated bits=0) by prime.gushi.org (8.18.1/8.18.1) with ESMTPSA id 51JMxavl015073 (version=TLSv1.2 cipher=ECDHE-ECDSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 19 Feb 2025 22:59:36 GMT (envelope-from freebsd@gushi.org) DKIM-Filter: OpenDKIM Filter v2.10.3 prime.gushi.org 51JMxavl015073 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gushi.org; s=prime2014; t=1740005976; bh=JdstuhSk24CLhO+irGLpAeBU87LEy23/KgWnDxWw5cc=; h=From:Subject:Date:To; z=From:=20"Dan=20Mahoney=20(Ports)"=20|Subject:= 20Should=20all=20services=20in=20rc.d=20support=20a=20status=20arg ument?|Date:=20Wed,=2019=20Feb=202025=2014:59:19=20-0800|To:=20que stions=20; b=LfFDXNJdPENBza/uO+evrCZwvyV419PpnFQYYioeNS+N748U/kQWB5hBvG4sIrNr9 qq2t9CU50wcHfWO9vnfGWIQRx9zrddxCF5uXAqWvrRfv3KOcK2caaCeir/CMlLD9gy r9GgtXV1m5aady0PJIeu862rrmmOq7ZOSPk8v9VCzopEEIdkZlhOr0PkcYWCTxPpW7 lGA3IvqjLp087aJa5kwc8XBq9qdCxpHODRu0pM8MXNRTn5I0lII3qnODSQnliNsJx7 5WlRlYDXNj7meBbGoZwpwmQiNfc9Gal9u1A+36XvSjuD/1IhXsefzxDJPxImMMbV41 mv8zqBMX2MvXQ== X-Authentication-Warning: prime.gushi.org: Host [IPv6:2601:602:400:8e7e:28d8:c721:395d:d1a9] claimed to be smtpclient.apple From: "Dan Mahoney (Ports)" Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: freebsd-questions@freebsd.org Sender: owner-freebsd-questions@FreeBSD.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.400.131.1.6\)) Subject: Should all services in rc.d support a status argument? Message-Id: <7BEE3985-47D4-4A08-9511-D73708A8F1FC@gushi.org> Date: Wed, 19 Feb 2025 14:59:19 -0800 To: questions X-Mailer: Apple Mail (2.3826.400.131.1.6) X-Spamd-Result: default: False [-3.96 / 15.00]; SUBJECT_ENDS_QUESTION(1.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; DWL_DNSWL_LOW(-1.00)[gushi.org:dkim]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.96)[-0.963]; RCVD_DKIM_ARC_DNSWL_MED(-0.50)[]; MV_CASE(0.50)[]; DMARC_POLICY_ALLOW(-0.50)[gushi.org,none]; ONCE_RECEIVED(0.20)[]; R_SPF_ALLOW(-0.20)[+mx]; RCVD_IN_DNSWL_MED(-0.20)[2620:137:6000:10::142:from]; R_DKIM_ALLOW(-0.20)[gushi.org:s=prime2014]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_ALL(0.00)[]; TO_DN_ALL(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; TO_MATCH_ENVRCPT_ALL(0.00)[]; ARC_NA(0.00)[]; DKIM_TRACE(0.00)[gushi.org:+]; RCVD_COUNT_ONE(0.00)[1]; ASN(0.00)[asn:393507, ipnet:2620:137:6000::/44, country:US]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; PREVIOUSLY_DELIVERED(0.00)[questions@freebsd.org]; MID_RHS_MATCH_FROM(0.00)[]; MLMMJ_DEST(0.00)[questions@freebsd.org]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_XAW(0.00)[] X-Rspamd-Queue-Id: 4YysKR05vGz3ZJZ X-Spamd-Bar: --- Hey there all, I=E2=80=99m in the process of implementing a nagios check at the dayjob = that basically ensures that all =E2=80=9Cenabled=E2=80=9D services are = running. (Arguably, the answer to a service that fell over is *not* = always to just quietly restart it). However, not all services support the =E2=80=9Cstatus=E2=80=9D command. For example, /usr/local/etc/rc.d/dma_flushq is just a hook to flush the = queue on boot =E2=80=94 it doesn=E2=80=99t start a process with a = long-running pidfile, and since there is no pidfile listes, there=E2=80=99= s no useful output to the =E2=80=9Cstatus=E2=80=9D command, and in fact, = this yields an error: # service dma_flushq status /usr/local/etc/rc.d/dma_flushq: unknown directive 'status'. Usage: /usr/local/etc/rc.d/dma_flushq = [fast|force|one|quiet](start|stop|restart|rcvar|enable|disable|delete|enab= led|describe|extracommands) # echo $? 1 But if we take something like sshguard, then rc.subr is smart enough to = look at the pidfile and figure out what I want, even though no special = status command has been defined in /usr/local/etc/rc.d/sshguard: # service sshguard status sshguard is running as pid 814. Now, I could go through each and every service in /usr/local/etc/rc.d, = and parse the auto-generated =E2=80=9CUsage:" to see what commands they = offer=E2=80=A6 # /usr/local/etc/rc.d/dma_flushq Usage: /usr/local/etc/rc.d/dma_flushq = [fast|force|one|quiet](start|stop|restart|rcvar|enable|disable|delete|enab= led|describe|extracommands) And use that to build a list of exceptions, but that=E2=80=99s annoying. So here=E2=80=99s my fun question: For scripts that don=E2=80=99t = *have* a status defined, should rc.subr simply return 0 with a nicer = message, because it=E2=80=99s not a statusable service? The =E2=80=9Cpractical rc.d scripting in FreeBSD=E2=80=9D document = mentions that =E2=80=9Cstatus=E2=80=9D is a standard command, but is = silent on this use-case. -Dan (Describe is also a valid command, but none of this stuff sets a = description, even in the base OS. I recall I took an action to make = more of this stuff pass rclint).=