3 # ============================================================================
5 # Copyright (C) THALES. All rights reserved
6 # Author: Jean-Noel Raguenes
8 # - V1.1: Herve Petit 10/03/2010
9 # - Raffinage du calcul du nb de lames pour prendre en compte
10 # que les interfaces eth1 sont aussi declarees dans /etc/hosts
11 # - Ajout appel a reboot_fe306.sh
12 # - V1.2: Herve Petit 02/06/2010
13 # - Ajout sleep 1 entre chaque appel reboot_fe306.sh car sinon seule la
14 # derniere fe306 etait rebootee
15 # - V1.3: Laurent Mazet 17/05/2013
16 # ============================================================================
19 # Provides: shutdownallblades
21 # Required-Stop: nfs-kernel-server
24 # Short-Description: Shutdown all blades
32 PATH
=/sbin
:/usr
/sbin
:/bin
:/usr
/bin
33 [ -f /etc
/default
/shutdownallblades
] && .
/etc
/default
/shutdownallblades
34 [ "$ENABLE" = "yes" ] ||
exit 0
36 .
/lib
/lsb
/init-functions
42 [ "$REBOOT" = "yes" -a ! "$(runlevel | cut -d' ' -f2)" = "0" ] && cmd
="reboot"
45 lg6500core
=/opt
/trc6500
/script
/stop_trc6500.sh
46 if [ -x $lg6500core ]; then
47 log_action_msg
"stoping lg6500core"
52 fe306
=/opt
/trc6500
/script
/reboot_fe306.sh
53 if [ -x $fe306 ]; then
54 for id
in $
(seq 1 6); do
56 grep $host /etc
/hosts
>&/dev
/null ||
continue
57 ( ping -c 1 $host >&/dev
/null
&& { log_action_msg
"shutdowning $host"; $fe306 -i $host >&/dev
/null
; } ) &
62 for host in $
(awk '{sub(/#.*/, "")} /trc[0-9][0-9]/ && ! /-rf/ {print $2}' /etc
/dhcp
/dhcpd.conf
); do
63 grep $host /etc
/hosts
>&/dev
/null ||
continue
64 ( ping -c 1 $host >&/dev
/null
&& { log_action_msg
"shutdowning ${host/_1}"; ssh root@
$host service
$cmd stop
; } ) &
67 trap "echo 'timeout expired ($TIMEOUT)'; exit 0;" SIGVTALRM
68 ( sleep $TIMEOUT; kill -SIGVTALRM $$
) &
75 echo "$(basename $0), version $VER"
80 restart|reload|force-reload
)
81 echo "Error: argument '$1' not supported" >&2
88 echo "Usage: $0 start|stop" >&2