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
28 DHCPCONF
=/etc
/dhcp
/dhcpd.conf
33 PATH
=/sbin
:/usr
/sbin
:/bin
:/usr
/bin
34 [ -f /etc
/default
/shutdownallblades
] && .
/etc
/default
/shutdownallblades
35 [ "$ENABLE" = "yes" ] ||
exit 0
37 .
/lib
/lsb
/init-functions
43 [ "$REBOOT" = "yes" -a ! "$(runlevel | cut -d' ' -f2)" = "0" ] && cmd
="reboot"
46 lg6500core
=/opt
/trc6500
/script
/stop_trc6500.sh
47 if [ -x $lg6500core ]; then
48 log_action_msg
"stoping lg6500core"
53 fe306
=/opt
/trc6500
/script
/reboot_fe306.sh
54 if [ -x $fe306 ]; then
55 for id
in $
(seq 1 6); do
57 grep $host /etc
/hosts
>&/dev
/null ||
continue
58 ( ping -c 1 $host >&/dev
/null
&& { log_action_msg
"shutdowning $host"; $fe306 -i $host >&/dev
/null
; } ) &
63 for host in $
(awk '{sub(/#.*/, "")} /host\s+trc[0-9][0-9]/ && ! /-rf/ {print $2}' $DHCPCONF); do
64 grep $host /etc
/hosts
>&/dev
/null ||
continue
65 ( ping -c 1 $host >&/dev
/null
&& { log_action_msg
"shutdowning ${host/_1}"; ssh root@
$host service
$cmd stop
; } ) &
68 trap "echo 'timeout expired ($TIMEOUT)'; exit 0;" SIGVTALRM
69 ( sleep $TIMEOUT; kill -SIGVTALRM $$
) &
76 echo "$(basename $0), version $VER"
81 restart|reload|force-reload
)
82 echo "Error: argument '$1' not supported" >&2
89 echo "Usage: $0 start|stop" >&2