Subject: Re: admin script for ipfilter
To: Darren Reed <darrenr@NetBSD.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: tech-userlevel
Date: 12/29/2006 18:21:07
I think called rcadmin would be fine, with usage like:

 rcadmin service_name argument

rcadmin looks at /etc/rc.d/ for the "service_name" and then looks at 
/usr/pkg/etc/rc.d/*. That should be configurable. FreeBSD's rc.conf has 
local_startup variable to list these startup script directories.

rcadmin runs the found script with the provided argument.

It does nothing else.

The rc.d scripts and rc.subr improved to allow

- enabling (rvar become ON or yes)

- disabling (rcvar become OFF or no)

- show status even if rcvar is OFF

- all commands can be used if even if are turned off via rc.conf


As it is now, we can get status of a service that "is disabled but the 
processes or whatever are actually active/running and if it is enabled but 
not active or running or whatever."

$ /etc/rc.d/inetd status             

$ /etc/rc.d/inetd onestatus
inetd is not running.

$ /etc/rc.d/inetd rcvar           
# inetd
$inetd=NO

$ sudo inetd

$ /etc/rc.d/inetd status          

$ /etc/rc.d/inetd onestatus       
inetd is running as pid 9511.

$ sudo /etc/rc.d/inetd onestop
Stopping inetd.
Waiting for PIDS: 9511.

$ /etc/rc.d/inetd onestatus    
inetd is not running.

The only think I don't like is having to do the "one" or "force" or "fast" 
...

Adding an argument called "bootstart" can be used in /etc/rc. And for 
rc.subr everything (other than bootstart and rcvar and future "enable" and 
"disable") sets ${rcvar} to YES. Then "one" prefix can be removed (or at 
least not documented) but keep fast and force since they have other 
purpose.

I'll patch rc.subr for that if that is okay and share it here.