From: Laurent Mazet Date: Fri, 4 Dec 2015 19:02:55 +0000 (+0100) Subject: correct service X-Git-Tag: debian_7.8.10~14^2 X-Git-Url: https://secure.softndesign.org/git/?a=commitdiff_plain;h=aa1a77f38ec5c946f83373ed76759cbc70cf17b5;hp=2751033a79ef82ea090624ede38dc8aeccd41727;p=debian6500.git correct service --- diff --git a/master/etc/init.d/etherwake b/master/etc/init.d/etherwake index 1fa7481..3e011ff 100755 --- a/master/etc/init.d/etherwake +++ b/master/etc/init.d/etherwake @@ -47,7 +47,7 @@ do_start () { n=0 while [ $NB_TRY -gt 0 ]; do - for mac in $(awk '{sub(/#.*/, "")} /trc[0-9]/ {gsub(/[;{}]/, " "); print $5}' $DHCPCONF); do + for mac in $(awk '{sub(/#.*/, "")} /host\s+trc[0-9]/ {gsub(/[;{}]/, " "); print $5}' $DHCPCONF); do host=$(awk '{sub(/#.*/, "")} /'$mac'/ {gsub(/[{}]/, " "); print $2}' $DHCPCONF) log_action_msg "Wake-up $host (EtherWake $mac)" diff --git a/master/etc/init.d/ipmiwake b/master/etc/init.d/ipmiwake index 4b1c0ca..541f363 100755 --- a/master/etc/init.d/ipmiwake +++ b/master/etc/init.d/ipmiwake @@ -35,8 +35,8 @@ do_action () { 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 $ACTION $ipmi)" ipmipower --session-timeout=$TIMEOUT -h $ipmi -u ADMIN -p ADMIN --$ACTION & diff --git a/master/etc/init.d/shutdownallblades b/master/etc/init.d/shutdownallblades index 29cfd31..ceb1183 100755 --- a/master/etc/init.d/shutdownallblades +++ b/master/etc/init.d/shutdownallblades @@ -25,6 +25,7 @@ VER=1.3 # Description: ### END INIT INFO +DHCPCONF=/etc/dhcp/dhcpd.conf REBOOT="no" TIMEOUT=15 ENABLE="yes" @@ -59,7 +60,7 @@ do_stop () { fi # shutdown all blades - for host in $(awk '{sub(/#.*/, "")} /trc[0-9][0-9]/ && ! /-rf/ {print $2}' /etc/dhcp/dhcpd.conf); do + for host in $(awk '{sub(/#.*/, "")} /host\s+trc[0-9][0-9]/ && ! /-rf/ {print $2}' $DHCPCONF); do grep $host /etc/hosts >&/dev/null || continue ( ping -c 1 $host >&/dev/null && { log_action_msg "shutdowning ${host/_1}"; ssh root@$host service $cmd stop; } ) & done diff --git a/master/etc/init.d/wakeonlan b/master/etc/init.d/wakeonlan index d67a847..32151e9 100755 --- a/master/etc/init.d/wakeonlan +++ b/master/etc/init.d/wakeonlan @@ -41,8 +41,8 @@ do_start () { log_action_msg "Activate Wake On Lan" - for mac in $(awk '{ sub(/#.*/, "") } /trc[0-9]/ { gsub(/[;{}]/, " "); print $5}' $DHCPCONF); do - broadcast=$(grep $mac $DHCPCONF | sed 's/.* \([0-9.]*\)\..*/\1.255/') + for mac in $(awk '{sub(/#.*/, "")} /host\s+trc[0-9]/ { gsub(/[;{}]/, " "); print $5}' $DHCPCONF); do + broadcast=$(awk '{sub(/#.*/, "")} /'$mac'/ {print}' $DHCPCONF | sed 's/.* \([0-9.]*\)\..*/\1.255/') host=$(awk '{sub(/#.*/, "")} /'$mac'/ {gsub(/[{}]/, " "); print $2}' $DHCPCONF) log_action_msg "Wake-up $host (WOL $mac $broadcast)" wakeonlan -p 7 -i $broadcast $mac