clean code
[debian6500.git] / master / etc / init.d / etherwake
index 401992e9c37564c16bdf113271e9eba2a61b6636..d23bccb09a3d660dc8736fafadebb71cb5b76501 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-VER=1.3
+VER=1.4
 # ============================================================================
 #
 # Copyright (C) THALES. All rights reserved
@@ -13,6 +13,8 @@ VER=1.3
 #   temps entre 2 wake
 # - V1.3: Laurent Mazet 02/05/2013
 #   Daemonisation
+# - V1.4: Laurent Mazet & Thomas Perennou 03/12/2014
+#   Legers correctifs
 # ============================================================================
 
 ### BEGIN INIT INFO
@@ -45,10 +47,10 @@ do_start () {
     n=0
     while [ $NB_TRY -gt 0 ]; do
 
-        for mac in $(awk '{sub(/#.*/, "")} /trc[0-9]/ {gsub(/;/, " "); print $6}' $DHCPCONF); do
-            host=$(awk '{sub(/#.*/, "")} /'$mac'/ {print $2}' $DHCPCONF)
+        for mac in $(awk '{sub(/#.*/, "")} /trc[0-9]/ {gsub(/[;{}]/, " "); print $5}' $DHCPCONF); do
+            host=$(awk '{sub(/#.*/, "")} /'$mac'/ {gsub(/[{}]/, " "); print $2}' $DHCPCONF)
 
-            log_action_msg "Wake-up $host ($mac)"
+            log_action_msg "Wake-up $host (EtherWake $mac)"
             etherwake $mac
 
            n=$(expr $n + 1)