[Nut-upsuser] POWERDOWNFLAG (/etc/killpower) does not contain the

Peter Selinger selinger at mathstat.dal.ca
Thu Sep 14 02:09:32 UTC 2006


Try pasting it just before: "# See if we need to cut the power"

You should test this of course, by unplugging the UPS and waiting
until the battery runs out. Your computer should shut down gracefully
(but you should be prepared in case it does not). 

-- Peter

Pino Mauro wrote:
> 
> --===============1420676555==
> Content-Type: multipart/alternative; boundary="0-1777563259-1158165369=:64633"
> 
> --0-1777563259-1158165369=:64633
> Content-Type: text/plain; charset=iso-8859-1
> 
> My halt script is in /etc/init.d and contain:
> 
> #! /bin/sh
> ### BEGIN INIT INFO
> # Provides:          halt
> # Required-Start:    umountroot
> # Required-Stop:
> # Should-Start:      lvm raid2
> # Should-Stop:
> # Default-Start:     0
> # Default-Stop:
> # Short-Description: Execute the halt command.
> # Description:
> ### END INIT INFO
> #
> # Version:      @(#)halt  2.85-22  19-Jun-2004  miquels at cistron.nl
> #
> 
> PATH=/sbin:/bin:/usr/sbin:/usr/bin
> . /lib/lsb/init-functions
> 
> # Get the default from /etc/default/halt.
> [ -f /etc/default/halt ] && . /etc/default/halt
> 
> do_stop () {
>         if [ "$INIT_HALT" = "" ]
>         then
>                 case "$HALT" in
>                         [Pp]*)
>                                 INIT_HALT=POWEROFF
>                                 ;;
>                         [Hh]*)
>                                 INIT_HALT=HALT
>                                 ;;
>                         *)
>                                 INIT_HALT=POWEROFF
>                                 ;;
>                 esac
>         fi
> 
>         # See if we need to cut the power.
>         if [ "$INIT_HALT" = "POWEROFF" ] && [ -x /etc/init.d/ups-monitor ]
>         then
>                 /etc/init.d/ups-monitor poweroff
>         fi
> 
>         # Don't shut down drives if we're using RAID.
>         hddown="-h"
>         if grep -qs '^md.*active' /proc/mdstat
>         then
>                 hddown=""
>         fi
> 
>         # If INIT_HALT=HALT don't poweroff.
>         poweroff="-p"
>         if [ "$INIT_HALT" = "HALT" ]
>         then
>                 poweroff=""
>         fi
> 
>         log_action_msg "Will now halt"
>         halt -d -f -i $poweroff $hddown
> }
> 
> case "$1" in
>     start)
>         ;;
>     restart|reload|force-reload)
>         echo "Error: argument '$1' not supported" >&2
>         exit 3
>         ;;
>     stop)
>         do_stop
>         ;;
>     *)
>         echo "Usage: $0 start|stop" >&2
>         exit 3
>         ;;
> esac
> 
> : exit 0
> 
> Where i can paste the code for powerdownflag? First of the "case in $1..." is ok?
> 
>  __________________________________________________
> Do You Yahoo!?
> Poco spazio e tanto spam? Yahoo! Mail ti protegge dallo spam e ti da tanto spazio gratuito per i tuoi file e i messaggi 
> http://mail.yahoo.it 
> --0-1777563259-1158165369=:64633
> Content-Type: text/html; charset=iso-8859-1
> 
> My halt script is in /etc/init.d and contain:<br><br>#! /bin/sh<br>### BEGIN INIT INFO<br># Provides:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; halt<br># Required-Start:&nbsp;&nbsp;&nbsp; umountroot<br># Required-Stop:<br># Should-Start:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lvm raid2<br># Should-Stop:<br># Default-Start:&nbsp;&nbsp;&nbsp;&nbsp; 0<br># Default-Stop:<br># Short-Description: Execute the halt command.<br># Description:<br>### END INIT INFO<br>#<br># Version:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @(#)halt&nbsp; 2.85-22&nbsp; 19-Jun-2004&nbsp; miquels at cistron.nl<br>#<br><br>PATH=/sbin:/bin:/usr/sbin:/usr/bin<br>. /lib/lsb/init-functions<br><br># Get the default from /etc/default/halt.<br>[ -f /etc/default/halt ] &amp;&amp; . /etc/default/halt<br><br>do_stop () {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if [ "$INIT_HALT" = "" ]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>  then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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nbsp;&nbsp;&nbsp;&nbsp; /etc/init.d/ups-monitor poweroff<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fi<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Don't shut down drives if we're using RAID.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hddown="-h"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if grep -qs '^md.*active' /proc/mdstat<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>  hddown=""<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fi<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # If INIT_HALT=HALT don't poweroff.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; poweroff="-p"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if [ "$INIT_HALT" = "HALT" ]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; poweroff=""<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fi<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; log_action_msg "Will now halt"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; halt -d -f -i $poweroff $hddown<br>}<br><br>case "$1" in<br>&nbsp;&nbsp;&nbsp; start)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;;<br>&nbsp;&nbsp;&nbsp; restart|reload|force-reload)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo "Error: argument '$1' not supported" &gt;&amp;2<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit
>  3<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;;<br>&nbsp;&nbsp;&nbsp; stop)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; do_stop<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;;<br>&nbsp;&nbsp;&nbsp; *)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo "Usage: $0 start|stop" &gt;&amp;2<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit 3<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;;<br>esac<br><br>: exit 0<br><br>Where i can paste the code for powerdownflag? First of the "case in $1..." is ok?<br><p>&#32;__________________________________________________<br>Do You Yahoo!?<br>Poco spazio e tanto spam? Yahoo! Mail ti protegge dallo spam e ti da tanto spazio gratuito per i tuoi file e i messaggi <br>http://mail.yahoo.it 
> --0-1777563259-1158165369=:64633--
> 
> 
> --===============1420676555==
> Content-Type: text/plain; charset="us-ascii"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Content-Disposition: inline
> 
> _______________________________________________
> Nut-upsuser mailing list
> Nut-upsuser at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser
> 
> --===============1420676555==--
> 




More information about the Nut-upsuser mailing list