Subject: Re: ups-nut rc.d scripts
To: Martin Husemann <email@example.com>
From: Johnny Lam <firstname.lastname@example.org>
Date: 11/20/2001 11:49:02
On Tue, Nov 20, 2001 at 08:25:27PM +0100, Martin Husemann wrote:
> > I'm not sure I understand your point. The upsd script has one variable
> > "upsd" controlling the start of two programs. The upsmon script is simpler
> > as it only needs to control one program, so it just looks like one of the
> > other rc.d scripts in /etc/rc.d.
> We could split that into two scripts and two variables. I have only two
> systems which run upsd, but all run upsmon.
No. If you look at the scripts that I'd posted, you'll see that the upsd
script starts whatever program is necessary to talk to the UPS through the
serial port and starts the upsd server. It would be wrong to split these
two bits into two separate scripts as they're required to be both started,
or neither will work correctly.
As for upsmon, from what I read in the documentation, upsmon can be run on
any client, and talks to the upsd that is running on the hosts listed in
upsmon.conf. Thus, it shouldn't require that upsd be running on the
localhost, but rather it should expect that the upsmon.conf file is correct.
> (I have two UPSs, and lots of computers connected to each. Only the computer
> with a serial connection to the UPS runs upsd)
Right. This situation is what is covered in the two scripts that I'd posted.
> We must make sure that upsmon is run after upsd, if upsd is to be run.
> I.e.: either upsmon is run alone, without upsd, or, if both are to be run,
> upsd has to initialize before upsmon can connect to it.
See what I wrote above. Again, if you look at the script that I'd posted,
you'll see that the upsmon script has the upsd script as a requirement, so
that the latter is executed prior to the former at start-time. The only
time this breaks is if you set upsd=NO and upsmon=YES in rc.conf, but don't
have another upsd on your network, but this only breaks if your upsmon.conf
incorrectly says that upsd is supposed to be running on the localhost.
I'm hoping that someone will be able to test the scripts that I'd posted, as
I'm unable to do the testing myself due to lack of equipment.
-- Johnny Lam <email@example.com>