X-Git-Url: https://secure.softndesign.org/git/?a=blobdiff_plain;f=master%2Fetc%2Finit.d%2Fipmiwake;h=541f363d4d83d38393e3b7bb0dbff0190daa11b0;hb=aa1a77f38ec5c946f83373ed76759cbc70cf17b5;hp=d20b9bc3c1c26811b0be7da68a55bb04a9721ebd;hpb=15db1f56a5e1ba259d761fd16dc997f91e3f5827;p=debian6500.git diff --git a/master/etc/init.d/ipmiwake b/master/etc/init.d/ipmiwake index d20b9bc..541f363 100755 --- a/master/etc/init.d/ipmiwake +++ b/master/etc/init.d/ipmiwake @@ -9,7 +9,7 @@ VER=1.0 ### BEGIN INIT INFO # Provides: ipmiwake -# Required-Start: $network +# Required-Start: $network waitswitches # Required-Stop: # Should-Start: # Default-Start: S @@ -28,17 +28,18 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin . /lib/lsb/init-functions -do_start () { +do_action () { + ACTION=$1 - log_action_msg "Send IPMI boot command" + log_action_msg "Send IPMI boot $ACTION command" ip addr add 10.133.25.1/24 dev eth0 - for mac in $(awk '{ sub(/#.*/, "") } /trc[0-9]/ && ! /-rf/ { gsub(/[;{}]/, " "); print $5}' $DHCPCONF); do - ipmi=$(grep $mac $DHCPCONF | sed 's/.* [0-9.]*\.\([0-9][0-9]*\)[^0-9].*/10.133.25.\1/') + for mac in $(awk '{sub(/#.*/, "")} /host\s+trc[0-9]/ && ! /-rf/ { gsub(/[;{}]/, " "); print $5}' $DHCPCONF); do + ipmi=$(awk '{sub(/#.*/, "")} /'$mac'/ {print}' $DHCPCONF | sed 's/.* [0-9.]*\.\([0-9][0-9]*\)[^0-9].*/10.133.25.\1/') host=$(awk '{sub(/#.*/, "")} /'$mac'/ {gsub(/[{}]/, " "); print $2}' $DHCPCONF) - log_action_msg "Wake-up $host (IPMI boot $ipmi)" - ipmipower --session-timeout=$TIMEOUT -h $ipmi -u ADMIN -p ADMIN --on & + log_action_msg "Wake-up $host (IPMI boot $ACTION $ipmi)" + ipmipower --session-timeout=$TIMEOUT -h $ipmi -u ADMIN -p ADMIN --$ACTION & done wait @@ -51,14 +52,14 @@ case "$1" in echo "$(basename $0), version $VER" ;; start) - do_start + do_action on ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop) - # No-op + do_action off ;; *) echo "Usage: $0 start|stop" >&2