[Nut-upsuser] Various NUT issues/questions

Scott Tuc Ellentuch at T-B-O-H ml at t-b-o-h.net
Sat May 13 13:52:27 UTC 2006


> 
> Try poking around in /etc/rc.d, /etc/rc.d/rc.0. 
>
	There isn't an /etc/rc.d/rc.0 . As for /etc/rc.d/ I tried looking
for anything that remounted the disks read only, and I didn't find anything.
> 
> There is a reasonable explanation of how BSD init scripts work, with
> example scripts, at 
> http://www.linuxfromscratch.org/hints/downloads/files/bsd-init.txt
>
	It looks like FreeBSD might not follow that. Under /etc/rc.d
we have :

DAEMON          dumpon          kpasswdd        ntpd            securelevel
LOGIN           early.sh        ldconfig        ntpdate         sendmail
NETWORKING      fsck            local           othermta        serial
SERVERS         gbde            localpkg        pccard          sppp
abi             gbde_swap       lpd             pcvt            sshd
accounting      hostname        mixer           pf              swap1
addswap         ike             motd            pflog           syscons
adjkerntz       inetd           mountcritlocal  power_profile   sysctl
amd             initdiskless    mountcritremote ppp-user        syslogd
apm             initrandom      mountd          pppoed          timed
apmd            ip6addrctl      moused          preseedrandom   tmp
archdep         ip6fw           mroute6d        pwcheck         ugidfw
atm1            ipfilter        mrouted         quota           usbd
atm2            ipfs            msgs            random          var
atm3            ipfw            named           rarpd           vinum
bgfsck          ipmon           natd            rcconf.sh       virecover
bootparams      ipnat           netif           resolv          watchdogd
ccd             ipsec           netoptions      root            ypbind
cleanvar        ipxrouted       network_ipv6    route6d         yppasswdd
cleartmp        isdnd           nfsclient       routed          ypserv
cron            jail            nfsd            routing         ypset
devd            kadmind         nfslocking      rpcbind         ypupdated
devfs           kerberos        nfsserver       rtadvd          ypxfrd
dhclient        keyserv         nisdomain       rwho
dmesg           kldxref         nsswitch        savecore

	It seems to determine what to run, and which priority at 
startup/shutdown by a code block at the top :

	For named:

# PROVIDE: named
# REQUIRE: SERVERS cleanvar
# BEFORE:  DAEMON
# KEYWORD: shutdown


	For syslogd:

# PROVIDE: syslogd
# REQUIRE: mountcritremote cleanvar
# BEFORE:  SERVERS


	And then calls "rcorder" to determine the order. When you
do a shutdown, it just does the order backwards (And some other
stuff, but in general). It passes "stop" to them, and some of the
scripts have "start/stop" case statements like for a supplemental
program "avahi" (The ones in rc.d were too long to show complete):

start_cmd=avahi_daemon_start
stop_cmd=avahi_daemon_stop

avahi_daemon_bin=/usr/local/sbin/avahi-daemon

avahi_daemon_start() {
    checkyesno avahi_daemon_enable && echo "Starting avahi-daemon." && \
        ${avahi_daemon_bin} ${avahi_daemon_flags}
}

avahi_daemon_stop() {
    checkyesno avahi_daemon_enable && echo "Stopping avahi-daemon." && \
        ${avahi_daemon_bin} -k
}


	We also don't have an inittab. Our init can only be
called with what "security level" you want it to, not run level.


	So, it seems, it doesn't operate in that manner at all.
>
> My understanding is that rc.shutdown is called before the actual
> shutdown procedure, and is mostly intended (I assume) for user-defined
> tasks not directly related to the physical shutdown itself.
>
	Ok. I just need to figure out what happens AFTER that
rc.shutdown is called. I guess I'll be starting/stopping my machine
alot later today to see what happens after rc.shutdown is called
and figure out where it is.

		Thanks, Tuc 
> -- Peter
> 
> Scott "Tuc" Ellentuch at T-B-O-H wrote:
> > 
> > > > 	Is there anything I can do to let the machine shut down
> > > > all the way THEN the UPS? 
> > > 
> > > Yes, of course, that's what you were *supposed* to do :)
> > > You have to put the command that yanks the power from the computer at
> > > the very *end* of your shutdown script, i.e., after all the file
> > > systems have been unmounted (or remounted read-only, in the case of
> > > the root file system, which hopefully contains the newhidups driver
> > > and upsdrvctl).
> > >
> > 	If there is someone running FreeBSD, I'd like to hear where
> > they put it. From checking Google :
> > 
> > http://www.bsdforums.org/forums/archive/index.php/t-5071.html
> > http://forums.bsdnexus.com/viewtopic.php?pid=3447
> > 	(NetBSD, but FreeBSD acts the same)
> > http://lists.alioth.debian.org/pipermail/nut-upsuser/2005-August/000173.html
> > 
> > 	They all suggest putting it into the bottom of /etc/rc.shutdown .
> > So thats where I put it. I tried to research the shutdown procedure for
> > FreeBSD, and the best I could find was :
> > 
> > http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/boot-shutdown.html
> > 
> > 	Which again talks about rc.shutdown. I don't know what else
> > it does afterwards so I can stick it in someplace else. 
> > 
> > 	So I put it where others suggest, and from where I could tell
> > was the right place. So now I know its the wrong place. But then 
> > does anyone know in FreeBSD where the right place is?
> > > 
> > > In other words, you want to yank the power just before /sbin/halt or
> > > /sbin/reboot or whatever would be called (this is from Linux; might
> > > look different but similar in *BSD). 
> > >
> > 	[INSTALL clip deleted...] 
> > > 
> > > > I tried changing ups.delay.shutdown
> > > > to 2 minutes and found that its 2 minutes from when you set it,
> > > > and it seemed to be a "HARD" down.. I had to press the button
> > > > to get it to start up again.
> > > > 
> > > > 	I hate to be a pain, but I'm not sure if its the UPS
> > > > I was guided to choose, my lack of knowledge of NUT, or my
> > > > desire to have what isn't available.
> > > 
> > > It's point 2, mostly, I am afraid :) -- Peter
> > > 
> > 	So thats what the mailing list is for. :) Why I'm
> > asking questions. Some get answered, some more haven't been.
> > 
> > 		Thanks, Tuc
> > 
> 




More information about the Nut-upsuser mailing list