home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.jcu.edu.au
/
2014.06.ftp.jcu.edu.au.tar
/
ftp.jcu.edu.au
/
v6.3.2b
/
SWBD63
/
fabos-6.3.2b-10.ppc.rpm
/
fabos-6.3.2b.10.cpio.gz
/
fabos-6.3.2b.10.cpio
/
fabos
/
cliexec
/
reboot
< prev
next >
Wrap
Text File
|
2010-11-10
|
4KB
|
165 lines
#!/bin/sh
#
# Copyright (c) 2001 Brocade Communications Systems, Inc.
# All rights reserved.
#
# File name: reboot
# Module name: fabos/src/utils/sys
#
# This script is wrapper to the traditional /sbin/reboot command
# so that /fabos/sbin/ will contain this wrapper to
# 1, Allow admin account to use it. admin account should not have
# /sbin/reboot (linux reboot) access in its PATH. If this reboot was
# invoked from dual CP actiove CP side, A prompt will show up for user
# confirmation.
# 2, FOS can call this function with -s option to skip the prompt.
# 3, FOS should call this function with -r option for reboot reason.
# The reboot reason will be displayed in raslog meassge HAM-1004
# after switch boot up.
# The reboot reason for -r option has to be one word without spcae.
# example: reboot -r ChassisConfig
#
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/fabos/bin:/fabos/sbin
chassis_info=`getchassisconfig`
ischassis=`echo $chassis_info | \
sed -n -e 's/.*Chassis based system: //gp' | \
sed -n -e 's/ .*//gp'`
#get reboot reason
REASON="Reboot"
FAST=""
SKIP_PROMPT="No"
CREBOOT="No"
while getopts r:sfc c > /dev/null
do
case $c in
r) REASON=$OPTARG
;;
s) SKIP_PROMPT="Yes"
;;
f) FAST="-f"
;;
c) CREBOOT="Yes"
;;
*)
echo "usage: reboot"
exit 1
;;
esac
done
#OPTION=$*
#remove -s and -r option
#echo $REASON
#OPTION=`echo $OPTION | /bin/sed "s/-r[ \t]\{1,\}[^ ]\{1,\}//;s/[ \t]*-s[ \t]\{1,\}//;s/[ \t]-s$//"`
OPTION=$FAST
#echo $OPTION
# #############################
# This is added to support the forced reset of the Zues FPGA, note that
# cpu reset (as done by this reboot) is not sufficient.
# The details of how and when are hidden in the driver which has exported
# this /proc/node
#
# swbd
#
# Retrieve the current system platform name, of the form "SWBDn", where n
# is cardinal number, assuming a sin/hinv input stream.
#
swbd() {
/bin/sed -n -e 's/^.*\(SWBD[[:digit:]]\{1,\}\).\+$/\1/gp'
}
# Determine the system platform identifier.
SWBD=$(sin | swbd 2> /dev/null)
case ${SWBD##SWBD} in
'76' )
zeus_fault=`cat /proc/fabos/blade/0/info | grep "blade fault reason" | grep 53`
if [ "$zeus_fault" ]
then
/sbin/fpga_update.sh
fi
if [ -e /etc/init.d/zeus_reconfig ]
then
/etc/init.d/zeus_reconfig start
/etc/init.d/zeus_reconfig stop
fi
;;
'72' )
#
# The devices that are connected to the embedded switches take more time to
# detect that the switch has been rebooted. This is because, the OLS is sent
# only when the chip is initialized during the next reboot session. So, issue
# a switchdisable to bring down the ports explicitly before the reboot to
# allow the hosts to detect the reboot scenario much earlier.
#
/fabos/cliexec/switchdisable
;;
esac
#
# Only prompt user on active cp on a chassis based system
# this reboot request was not called from "chassisReboot"
#
if [ "$ischassis" = "Yes" -a "$CREBOOT" = "No" ]; then
hashow_cmd="hashow -l"
case "$(hashow -l)" in
*ACTIVE*HA_ENABLED*)
is_active="Yes"
is_hadisabled="No"
;;
*STANDBY*HA_ENABLED*)
is_active="No"
is_hadisabled="No"
;;
*STANDBY*HA_DISABLED*)
is_active="No"
is_hadisabled="Yes"
;;
*ACTIVE*HA_DISABLED*)
is_active="Yes"
is_hadisabled="Yes"
;;
esac
if [ "$is_active" = "Yes" -a "$SKIP_PROMPT" = "No" ]; then
if [ "$is_hadisabled" = "No" ]; then
# text here revised per defect 78391
echo "Warning: This command is being run on a control processor (CP)"
echo "based system and will cause the active CP to reboot."
else
echo "Warning: This command is being run on a control processor (CP)"
echo "based system. Because HA is disabled, it will cause both active"
echo "and the standby CP to reboot."
echo "HA will be enabled after boot up."
fi
read -p "Are you sure you want to reboot the active CP [y/n]?" in
if [ "$in" != "y" -a "$in" != "Y" ]; then
exit
fi
fi
# If this is this is active CP and HA is currently then reboot
# the chassis and retain mastership.
if [ "$is_active" = "Yes" -a "$is_hadisabled" = "Yes" ]; then
/fabos/sbin/chassisReboot -m
fi
fi
#record boot reason
/sbin/hainfo RebootReason $REASON
/sbin/reboot $OPTION