correct services debian_7.8.9
authorLaurent Mazet <laurent.mazet@thalesgroup.com>
Fri, 4 Dec 2015 19:02:55 +0000 (20:02 +0100)
committerLaurent Mazet <laurent.mazet@thalesgroup.com>
Mon, 7 Dec 2015 13:10:28 +0000 (14:10 +0100)
master/etc/init.d/etherwake
master/etc/init.d/ipmiwake
master/etc/init.d/shutdownallblades
master/etc/init.d/wakeonlan

index 1fa7481e7497275ef3dcc87fcf7619c0fcdfb73f..3e011ffd0c7f3fa885a3e3135831257b74f0afb6 100755 (executable)
@@ -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)"
index 4b1c0ca2b50405938a72c3e9eca8bc0c6a76506a..541f363d4d83d38393e3b7bb0dbff0190daa11b0 100755 (executable)
@@ -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 &
index 29cfd31e596a62a177b37a96907953535790d4e1..ceb1183fd95ab146972f3964d79514a2983d17a2 100755 (executable)
@@ -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
index d67a847532a40cfd1f35ec01c8962a78a8169305..32151e9b5ef957aa43a6dc87e003d0ec06ce5404 100755 (executable)
@@ -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