Re: Should all services in rc.d support a status argument?

From: Paul Procacci <pprocacci_at_gmail.com>
Date: Thu, 20 Feb 2025 03:09:58 UTC
On Wed, Feb 19, 2025 at 9:12 PM Dan Mahoney (Ports) <freebsd@gushi.org> wrote:

> Which manpage is that from?  It's not listed that way in man rc, nor in man service?
>

man rc.subr

> Literally the first sentence in my email:
>
> >> I’m in the process of implementing a nagios check at the dayjob that basically ensures that all “enabled” services are running.
>
> This includes services that don't have daemons that listen on a TCP port or domain socket, but that *do* write PID files, for which the desired check is an individual service nnn status (which can be run as non-root users).
>

Yeah I saw this, but a simple pid check here is easy enough.  Why you
must insist on enumerating everything in /etc/rc.d or
/usr/local/etc/rc.d/ makes no sense as not everything is a long
standing process.
You should know the services running on a machine and should have
targeted checks for them.  That's my position anyways.

> I would enumerate those with "service -e", which shows all enabled services, including (as one example) dma_flushq.
>
> The "service" command makes no distinction between which services are things that run once at boot, and which things start long-running daemons, and that's what I'm looking for.  I suppose another command that would be useful is something like "service foo haspid".
>

Yeah, I get all this.  I personally think the word service is misused
here, but that's another topic for another day.

> Short of grepping everything in /usr/local/etc/rc.d for "pidfile" there's no good way to get that list.

And that may in fact be the way.

> -Dan
>

~Paul

-- 
__________________

:(){ :|:& };: