ipmiwake can also stop all blades
authorLaurent Mazet <laurent.mazet@thalesgroup.com>
Thu, 4 Dec 2014 18:19:38 +0000 (19:19 +0100)
committerLaurent Mazet <laurent.mazet@thalesgroup.com>
Thu, 4 Dec 2014 18:19:38 +0000 (19:19 +0100)
master/etc/init.d/ipmiwake

index 13f6ff8afaccc53675b025228674fe948ed9e509..4b1c0ca2b50405938a72c3e9eca8bc0c6a76506a 100755 (executable)
@@ -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/')
         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