Subject: Re: ups-nut rc.d scripts
To: Luke Mewburn <>
From: Johnny Lam <>
List: tech-pkg
Date: 11/20/2001 20:45:20
On Wed, Nov 21, 2001 at 03:28:30PM +1100, Luke Mewburn wrote:
> On Tue, Nov 20, 2001 at 07:55:32PM -0800, Johnny Lam wrote:
> > The ups-nut design has changed, and I think the recommended way to start
> > and stop the drivers now is through "upsdrvctl start|stop".  If we use
> > upsdrvctl, then we don't need to figure out the pidfile name as it's
> > taken care of by the program.
> That makes sense. I'll update my version and resubmit.

Actually, Simon Burge has just informed me that upsdrvctl can't control
all of the drivers yet, so I now think it's better not to rely on it.
We should have the driver specified in /etc/rc.conf as you had in your
upsdriver script.

> > taken care of by the program.  Using the argument as to why nmbd and smbd
> > in net/samba should be controlled by the same script, I argue that the the
> > UPS driver programs and upsd should be controlled by the same script: it
> > doesn't make sense to start one without the other.
> As the author of the rc.d stuff, I disagree (but that doesn't mean that
> you're not entitled to your opinion!)
> a) My local rc.d/samba script starts both smbd and nmbd at once,
>    because I see them as `tightly coupled'; you really don't run one
>    without the other, nor manipulate one without the other).
>    At the time, that seemed like a good idea (similar to
>    /etc/rc.d/nfslocking), but I am leaning now to the idea of
>    providing separate nmbd and smbd scripts that do the work, and a
>    `master' samba script which has 'KEYWORDS: nostart' for
>    administrator convenience.

I prefer this, as it makes writing the individual rc.d scripts simpler.
It also works nicer with /etc/rc.conf.d since the files in that directory
are named using the $name variable from the rc.d scripts; if the rc.d
scripts just control one program, then there will be a one-to-one
correspondence between the files in /etc/rc.conf.d and the scripts in

> In summary, ups-nut should install:
> 	/usr/pkg/etc/rc.d/upsdrvctl	manage ups driver
> 	/usr/pkg/etc/rc.d/upsd		manage upsd
> 	/usr/pkg/etc/rc.d/upsmon	manage upsmon
> 	/usr/pkg/etc/rc.d/upslog	manage upslog
> 	/usr/pkg/etc/rc.d/ups		front-end for the above for
> 					sysadmin convenience - not run
> 					by /etc/rc at startup

This sounds good to me, and since you've tested your scripts already, I'll
just take them from your earlier email and modify them slightly to work on
pre-rc.d systems.

> On another note, I don't believe that package installs should put stuff
> in /etc/rc.d. I strongly prefer that package rc.d scripts install into
> /usr/pkg/etc/rc.d, and then reminding the admin to manually install the
> rc.d scripts into /etc/rc.d.

I was thinking of copying them only if they respect the /etc/rc.conf settings,
and perhaps reminding the admin to set the proper variables in /etc/rc.conf.
Even if nothing is set in /etc/rc.conf, the rc.d script won't start the
package daemons unless the rcvar is set to YES.  This satisfies the principle
of least surprise, as the installed package daemons don't run unless the
admin does the step of adding the right settings to /etc.rc.conf, but doing
it this way makes it so there is just one stop fewer that the admin must do.
Or think of it as one fewer step that sysinst or sushi must do.


	-- Johnny Lam <>