Shutdown Script?
Mark McCulligh
mmcculli at visualtech.ca
Mon Aug 15 16:58:29 UTC 2005
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.
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.
Thanks again, now to see if it works.
Mark.
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
--
___________________________________________
Mark McCulligh, Web Consultant
VisualTech Components www.VisualTech.ca
mmcculli at visualtech.ca
(519)318-7905
More information about the Redhat-install-list
mailing list