Shutdown Script?

Rick Stevens rstevens at vitalstream.com
Mon Aug 15 17:24:30 UTC 2005


Mark McCulligh wrote:
> Thanks Rick for your help. It is exactly what I was looking for.
> 
> For all I have to do is create the file /etc/sysconfig/ups to declare 
> the variables server=yes and model=upsdrvctl.

I'm not that familiar with nut, but if the program to control the UPS
under nut is upsdrvctl, then yes, that's what you do.

> Than change where the halt script looks for the nut files. It is 
> installed in /usr/local/ups, not /etc/ups. I assume if I installed nut 
> using the rpm version it would have been install at /etc/ups.

Rather than bugger the script, why not set up a symbolic link in /etc to
point at your nut data:

	[root at hostname root]# ln -s /usr/local/ups /etc/ups

That way you leave the script alone but still get the data you need.

> Thanks again, now to see if it works.

No problem.  By the way, we prefer bottom posting on this list.

> Rick Stevens wrote:
> 
>> Mark McCulligh wrote:
>>
>>> Hi Group,
>>>
>>> I have just setup nut on my computer to manage my UPS.  I have to add 
>>> a couple lines of code to my shutdown script to power off my UPS.  Is 
>>> there a master shutdown script I should add these lines too or create 
>>> a new script and add it to init.d?
>>>
>>> I don't want to get this wrong and turn of the UPS at the wrong time.
>>
>>
>>
>> The system runs /etc/rc.d/init.d/halt as the last thing, so any commands
>> really belong there.  If you examine that script, you'll see that it
>> tries to do some UPS management itself, based on the presence of several
>> files (/etc/ups/upsmon.conf, /etc/killpower and /etc/sysconfig/ups) and
>> uses variables set in /etc/sysconfig/ups.
>>
>> If $SERVER is "yes" AND "$MODEL" is "upsdrvctl", then it runs upsdrvctl
>> and passes it the "shutdown" option:
>>
>>     /sbin/upsdrvctl shutdown
>>
>> If "$SERVER" is "yes", "$MODEL" is not null AND not equal to "NONE" AND
>> "$DEVICE" is not null, then it runs the program given in "$MODEL"
>> against "$DEVICE" and hands it the options specified in "$OPTIONS_HALT"
>> thusly:
>>
>>     $MODEL $OPTIONS_HALT -k $DEVICE
>>
>> Examine the script starting at around line 221 or so (in the FC4
>> version) to see what I'm talking about.  If none of this suits your
>> needs, add what you need somewhere in that section of the script or call
>> one of your own:
>>
>>     if [ "$SERVER" = "yes" -a "$MODEL" = "yourdevicename" ]; then
>>         /usr/local/your-shutdown-script
>>     fi
>>
>> Hope that helps.
>> ----------------------------------------------------------------------
>> - Rick Stevens, Senior Systems Engineer     rstevens at vitalstream.com -
>> - VitalStream, Inc.                       http://www.vitalstream.com -
>> -                                                                    -
>> -                       When in doubt, mumble.                       -
>> ----------------------------------------------------------------------
>>
>> _______________________________________________
>> Redhat-install-list mailing list
>> Redhat-install-list at redhat.com
>> https://www.redhat.com/mailman/listinfo/redhat-install-list
>> To Unsubscribe Go To ABOVE URL or send a message to:
>> redhat-install-list-request at redhat.com
>> Subject: unsubscribe
> 
> 
> 
> 


-- 
----------------------------------------------------------------------
- Rick Stevens, Senior Systems Engineer     rstevens at vitalstream.com -
- VitalStream, Inc.                       http://www.vitalstream.com -
-                                                                    -
-  BASIC is the Computer Science version of `Scientific Creationism' -
----------------------------------------------------------------------




More information about the Redhat-install-list mailing list