Init Files
Display of inittab File
Information Taken from /etc/inittab
#
# inittab This file describes how the INIT process should set up
# the system in a certain run-level.
#
# Author: Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
# Modified for RHS Linux by Marc Ewing and Donnie Barnes
#
# Default runlevel. The runlevels used by RHS are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
#
id:3:initdefault:
~~:S:wait:/sbin/sulogin
# System initialization.
si::sysinit:/etc/rc.d/rc.sysinit
l0:0:wait:/etc/rc.d/rc 0
l1:1:wait:/etc/rc.d/rc 1
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5
l6:6:wait:/etc/rc.d/rc 6
# Trap CTRL-ALT-DELETE
ca::ctrlaltdel:/sbin/shutdown -t3 -r now
# When our UPS tells us power has failed, assume we have a few minutes
# of power left. Schedule a shutdown for 2 minutes from now.
# This does, of course, assume you have powerd installed and your
# UPS connected and working correctly.
pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down"
# If power was restored before the shutdown kicked in, cancel it.
pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled"
# Run gettys in standard runlevels
1:2345:respawn:/sbin/mingetty tty1
2:2345:respawn:/sbin/mingetty tty2
3:2345:respawn:/sbin/mingetty tty3
4:2345:respawn:/sbin/mingetty tty4
5:2345:respawn:/sbin/mingetty tty5
6:2345:respawn:/sbin/mingetty tty6
# Run xdm in runlevel 5
x:5:respawn:/etc/X11/prefdm -nodaemon
SV:123456:respawn:/command/svscanboot
h1:35:respawn:/etc/init.d/init.evmd run >/dev/null 2>&1 </dev/null
h2:35:respawn:/etc/init.d/init.cssd fatal >/dev/null 2>&1 </dev/null
h3:35:respawn:/etc/init.d/init.crsd run >/dev/null 2>&1 </dev/null
Back to top
Display of init.crs File
Information Taken from /etc/init.d/init.crs
#!/bin/sh
#
# init.crs - Control script for the CRS product as a whole
#
# This should be linked into an appropriate rcX.d directory.
#
# Supported options:
# init.crs start manual startup of the CRS stack
# init.crs stop shuts down the CRS stack
# init.crs disable prevents CRS stack from starting at boot time
# init.crs enable allows CRS stack to start at boot time
#
ECHO=/bin/echo
SLEEP=/bin/sleep
BASENAME=/bin/basename
LOGMSG="/bin/logger -puser.err"
#Following variable is used only on SuSE
PARENT_CMD=""
case `/bin/uname` in
Linux) ID=/etc/init.d
LOGGER="/usr/bin/logger"
if [ ! -f "$LOGGER" ];then
LOGGER="/bin/logger"
fi
LOGMSG="$LOGGER -puser.err"
if [ -f /etc/SuSE-release ]; then
PARENT_CMD="`/bin/ps -p $PPID --no-headers -o comm`"
fi
;;
HP-UX) ID=/sbin/init.d;;
SunOS) ID=/etc/init.d;;
AIX) ID=/etc;;
OSF1) ID=/sbin/init.d;;
*) /bin/echo "ERROR: Unknown Operating System"
exit -1
;;
esac
case $1 in
'home')
$ID/init.cssd home
;;
'stop')
$ECHO "Shutting down Oracle Cluster Ready Services (CRS):"
# Prevent respawn of the daemons while we are shutting down.
$ID/init.cssd norun
# Reverse order of startup. crsd should be shutdown before
# cssd and evmd. evmd should be shutdown before cssd.
$ID/init.crsd $*
$ID/init.evmd $*
$ID/init.cssd $*
;;
'enable')
# This is the supported way of enabling the CRS stack's automatic startup.
$ID/init.cssd enable
;;
'disable')
# This is the supported way of disabling the CRS stack's automatic startup.
$ID/init.cssd disable
;;
'start')
CMD=`$BASENAME $0`
# If we are being invoked by the user, perform manual startup.
# If we are being invoked as an RC script, check for autostart.
if [ "$CMD" = "init.crs" ] && [ "$PARENT_CMD" != "startpar" ]; then
$LOGMSG "Oracle Cluster Ready Services starting by user request."
$ID/init.cssd manualstart
else
$ID/init.cssd autostart
fi
;;
'start_msg')
# start message if we are being invoked as an RC script (only on HP-UX)
$ECHO "Start Oracle Cluster Ready Services"
;;
'stop_msg')
# stop message if we are being invoked as an RC script (only on HP-UX)
$ECHO "Stop Oracle Cluster Ready Services"
;;
*)
$ECHO "Usage: $0 {stop|start|enable|disable}"
exit 1;
;;
esac
Back to top
Display of init.crsd File
Information Taken from /etc/init.d/init.crsd
#!/bin/sh
#
# init.crsd - Control script for the CRS daemon.
#
# This should not be linked into an rcX.d directory. It should
# only be invoked from init.crs or from inittab.
#
# No manual invocation of init.crsd is supported.
#
ORA_CRS_HOME=/u01/crs/11.1.0/db_1
ORACLE_USER=oracle
ORACLE_HOME=$ORA_CRS_HOME
export ORA_CRS_HOME
export ORACLE_HOME
UMASK=/bin/umask
SED=/bin/sed
CAT=/bin/cat
LOGMSG="/bin/logger -puser.err"
ECHO=/bin/echo
KILL=/bin/kill
RMF="/bin/rm -f"
SLEEP=/bin/sleep
TOUCH=/bin/touch
GREP=/bin/grep
PSE="/bin/ps -e"
LS=/bin/ls
AWK=/bin/awk
MVF="/bin/mv -f"
HEAD=/usr/bin/head
SU=/bin/su
# Incase /bin/hostname is not present in a particular platform, we
# may have to do something different.
HOSTN=/bin/hostname
EXPRN=/usr/bin/expr
CUT=/usr/bin/cut
TR=/bin/tr
#solaris on amd and SPARC has issue with /bin/tr
[ 'SunOS' = `/bin/uname` ] && TR=/usr/xpg4/bin/tr
#on linux tr is at /usr/bin/tr
[ 'Linux' = `/bin/uname` ] && TR=/usr/bin/tr
#If the hostname is an IP address, let hostname
#remain as IP address
HOST=`$HOSTN`
len1=`$EXPRN "$HOST" : '.*'`
len2=`$EXPRN match $HOST '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*'`
# Strip off domain name in case /bin/hostname returns
# FQDN hostname
if [ $len1 != $len2 ]; then
HOST=`$ECHO $HOST | $CUT -d'.' -f1 `
fi
HOST=`$ECHO $HOST | $TR '[:upper:]' '[:lower:]'`
UNIQUEDATE=`/bin/date '+%Y-%m-%d-%H:%M:%S'`
UNIQUECORE=core.$UNIQUEDATE
# Default path for SCR control files.
SCRDIR=/var/opt/oracle/scls_scr/$HOST
UNAME=/bin/uname
PLATFORM=`$UNAME`
MAXFILE=65536
case $PLATFORM in
Linux)
SCRDIR=/etc/oracle/scls_scr/$HOST
ID=/etc/init.d
LOGGER="/usr/bin/logger"
if [ ! -f "$LOGGER" ]; then
LOGGER="/bin/logger"
fi
LOGMSG="$LOGGER -puser.err"
if [ ! -f "$UMASK" ]; then
UMASK=umask
fi
SETULIMITFORLOCKEDMEMORY="ulimit -l unlimited"
$SU -l $ORACLE_USER -c "$ECHO \$TZ > /tmp/oratz.$$ " > /dev/null 2>&1
NEWTZ=`$SED 's/^[ \t]*//;s/[ \t]*$//' < /tmp/oratz.$$`
$RMF /tmp/oratz.$$
if [ ! -z "$NEWTZ" ]; then
TZ=$NEWTZ;
export TZ;
fi
;;
HP-UX)
ID=/sbin/init.d
;;
SunOS)
ID=/etc/init.d
VER=`$UNAME -r | $SED -e 's/\.//g'`
;;
AIX)
SCRDIR=/etc/oracle/scls_scr/$HOST
ID=/etc
;;
OSF1)
ID=/sbin/init.d
;;
*) /bin/echo "ERROR: Unknown Operating System"
exit -1
;;
esac
# This file controls how the CRS flags are set. On a manual startup
# or on an automatic startup, this file will exist. init.crsd run will
# remove the file and invoke one-time-only actions.
CRSDBOOT=$SCRDIR/root/crsdboot
# This file contains the PID of the running CRSD
PIDFILE=$ORA_CRS_HOME/crs/init/$HOST.pid
# Flags file for CRSD
FLAGFILE=$ORA_CRS_HOME/crs/init/$HOST.flags
case $1 in
'home')
$ECHO $ORA_CRS_HOME
exit 0;
;;
'stop')
[ -r $PIDFILE ] && crspid=`$CAT $PIDFILE`
$LOGMSG "Oracle CRSD $crspid set to stop"
# Indicate that the next time we start up, it may be an initial startup.
$ECHO "stopped" > $CRSDBOOT
$LOGMSG "Oracle CRSD $crspid shutdown completed"
;;
'run') # foreground run out of init
# Check to see if we are supposed to run this boot.
$ID/init.cssd startcheck
while [ "$?" != "0" ]; do
# recheck every once in a while, in case manual startup is invoked
$SLEEP 30
$ID/init.cssd startcheck
done
# Check to see if this is the first time CRSD has started this boot.
FIRST=false
CRSDID=`$CAT $CRSDBOOT`
BOOTID=`$ID/init.cssd bootid`
BOOTFLAG=restart
if [ "$CRSDID" != "$BOOTID" ]; then
$RMF $PIDFILE
# Do not execute these one-time actions again.
$ECHO "$BOOTID" > $CRSDBOOT
BOOTFLAG=reboot
fi
# Allow the daemon to drop a diagnostic core file
ulimit -c unlimited
# Fix for bug 7483048; warning in alert.log for low open file descriptors
ulimit -n $MAXFILE
cd $ORA_CRS_HOME/log/$HOST/crsd
# Fix for bug 3784537; instance crashes with VLM enabled and
# a low locked memory limit (ulimit -l). For eg. the
# OS default value of 4KB isn't sufficient.
if [ "$SETULIMITFORLOCKEDMEMORY" ]; then
$SETULIMITFORLOCKEDMEMORY
fi
# If there is an old corefile by such a collision prone name, then
# rename it to something safe.
if [ -f ./core ]; then
$MVF ./core "$UNIQUECORE"
fi
# keep crsd log/trace from being world readable.
$UMASK `$UMASK | $SED 's/.$/6/'`
$LOGMSG "Running CRSD with TZ = $TZ"
# foreground run out of init
shift
if [ "$PLATFORM" -eq "SunOS" -a "$VER" -ge "510" ]; then
# For Solaris 10 crsd must be started in the correct oracle project
PROJECT=`projects -d $ORACLE_USER`
newtask -p $PROJECT $ORA_CRS_HOME/bin/crsd $BOOTFLAG $*
else
$ORA_CRS_HOME/bin/crsd $BOOTFLAG $*
fi
# Perform some quick system sanity checks.
NEWBOOTID=`$ID/init.cssd bootid`
if [ "$NEWBOOTID" != "$BOOTID" ]; then
$LOGMSG "Oracle CRSD respawn disabled due to change in bootid."
$ECHO "stopped" > $CRSDBOOT
fi
NEWHOST=`$HOSTN`
len1=`$EXPRN "$NEWHOST" : '.*'`
len2=`$EXPRN match $NEWHOST '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*'`
# Strip off domain name in case /bin/hostname returns
# FQDN hostname
if [ $len1 != $len2 ]; then
NEWHOST=`$ECHO $NEWHOST | $CUT -d'.' -f1 `
fi
NEWHOST=`$ECHO $NEWHOST | $TR '[:upper:]' '[:lower:]'`
if [ "$NEWHOST" != "$HOST" ]; then
$LOGMSG "Oracle CRSD respawn disabled. Unsupported change in hostname."
$ECHO "stopped" > $CRSDBOOT
fi
$ID/init.cssd runcheck
if [ "$?" != "0" ]; then
# here we attempted to start up, but failed. If we are
# supposed to be shutdown, then mark the shutdown state.
$ECHO "stopped" > $CRSDBOOT
fi
;;
'tz') #Print TZ value
$ECHO $TZ
;;
*)
$ECHO "Manual invocation of $0 is not supported."
;;
esac
Back to top
Display of init.cssd File
Information Taken from /etc/init.d/init.cssd
#!/bin/sh
#
# Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
#
# init.cssd - Control script for the Oracle CSS daemon.
#
# In a full RAC install, this should not be in an rcX.d
# directory. It should only be invoked from init.crs.
# Never by hand.
#
# No manual invocation of init.cssd is supported on a cluster.
#
# In a local, non-cluster, installation without RAC, it should
# be placed in an rcX.d directory. It may be invoked by hand
# if necessary, however there are a series of risks and complications
# that should be kept in mind when doing so.
#
# Actions usable in local-only configuration are:
# start, stop, disable and enable.
#
# ==========================================================
# Porting Definitions and requirements:
#
# FAST_REBOOT - take out the machine now. We are concerned about
# data integrity since the other node has evicted us.
# SLOW_REBOOT - We can rely on vendor clusterware to delay sending
# the reconfig to the other node due to its IO fencing
# guarantees. So trigger its diagnostic reboot.
# VC_UP - Determine whether Vendor clusterware processes are active.
# If they are, then the remote node will hear that CSS/CLSVMON
# have died, and we will be forced to use FAST_REBOOT.
# This is also used at startup time for dependency checking.
# Returns 0 if they are up, 1 otherwise. This should be
# an extremely fast check.
# CLINFO - Determine whether we are booted in non-cluster mode.
# Returns 0 for cluster mode, 1 for non-cluster mode
# This call is allowed to take a long time to decide.
#
# GETBOOTID - Returns a string that uniquely identifies this boot.
# This string must never change while the machine is up,
# and must change the next time the machine boots.
ORA_CRS_HOME=/u01/crs/11.1.0/db_1
ORACLE_USER=oracle
ORACLE_HOME=$ORA_CRS_HOME
export ORACLE_HOME
export ORA_CRS_HOME
export ORACLE_USER
# Set DISABLE_OPROCD to false. Platforms that do not ship an oprocd
# binary should override this below.
DISABLE_OPROCD=false
# Default OPROCD timeout values defined here, so that it can be
# over-ridden as needed by a platform.
# default Timout of 1000 ms and a margin of 500ms
OPROCD_DEFAULT_TIMEOUT=1000
OPROCD_DEFAULT_MARGIN=500
# default Timeout for other actions
OPROCD_CHECK_TIMEOUT=2000
OPROCD_STOP_TIMEOUT=2000
OPROCD_DEFAULT_HISTORGRAM=
# Incase /bin/hostname is not present in a particular platform, we
# may have to do something different.
HOSTN=/bin/hostname
EXPRN=/usr/bin/expr
CUT=/usr/bin/cut
AWK='/bin/awk'
ECHO='echo'
TR=/bin/tr
#solaris on amd and SPARC has issue with /bin/tr
[ 'SunOS' = `/bin/uname` ] && TR=/usr/xpg4/bin/tr
#on Linux tr is at /usr/bin/tr
[ 'Linux' = `/bin/uname` ] && TR=/usr/bin/tr
#If the hostname is an IP address, let hostname
#remain as IP address
HOST=`$HOSTN`
len1=`$EXPRN "$HOST" : '.*'`
len2=`$EXPRN "$HOST" : '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*'`
# Strip off domain name in case /bin/hostname returns
# FQDN hostname
if [ $len1 != $len2 ]; then
HOST=`$ECHO $HOST | $CUT -d'.' -f1 `
fi
HOST=`$ECHO $HOST | $TR '[:upper:]' '[:lower:]'`
# Default Location for commands on most platforms
PS='/bin/ps'
# ps -e is expected to search for all processes on the box and provide
# terse binary name output so that column count does not truncate binary
# names and confuse grep.
PSE='/bin/ps -e'
PSEF='/bin/ps -ef'
HEAD='/bin/head'
GREP='/bin/grep'
KILL='/bin/kill'
KILLTERM='/bin/kill -TERM'
KILLDIE='/bin/kill -9'
KILLCHECK="/bin/kill -0 $$"
SLEEP='/bin/sleep'
NULL='/dev/null'
UNAME='/bin/uname'
CAT='/bin/cat'
RMF='/bin/rm -f'
TEST='/bin/test'
WCL='/bin/wc -l'
TOUCH='/bin/touch'
SU='/bin/su'
SED='/bin/sed'
RENICE='/bin/renice'
RTGPID='/bin/priocntl -s -c RT -i pgid'
XARGS='/bin/xargs'
PWD_COMMAND=/usr/bin/pwd
MVF="/bin/mv -f"
EVAL=eval
LS='/bin/ls'
BASENAME=/bin/basename
DATE="/bin/date"
MKDIRP="/bin/mkdir -p"
CHOWN="/bin/chown"
SYNC='/bin/sync'
USING_VC=0 # not using vendor clusterware by default
USING_DISKMON='false' # not using diskmon by default
# This should be a noop on non-Linux platforms.
OMONSLEEP=""
# Default value for sleep when doing a sync
SYNCSLEEP='0'
UNIQUEDATE=`/bin/date '+%Y-%m-%d-%H:%M:%S'`
UNIQUECORE=core.$UNIQUEDATE
FINDCLSVMON="$PS -e -o comm,pid | $GREP '^oclsvmon'"
FINDCLSOMON="$PS -e -o comm,pid | $GREP '^oclsomon'"
FINDCSSD="$PS -e -o comm,pid | $GREP '^ocssd'"
FINDPROCD="$PS -e -o comm,pid | $GREP '^oprocd'"
FINDDISKMON="$PS -e -o comm,pid | $GREP '^diskmon'"
# Error reporting commands. These need to be kept in sync with
# the value of $MSGFILE in root.sh.
LOGERR="/bin/logger -puser.alert"
LOGMSG="/bin/logger -puser.err"
# See discussion in LocalFence below.
CLEANREBOOTLOCK=/bin/true
OPROCD=$ORA_CRS_HOME/bin/oprocd
CRSCTL=$ORA_CRS_HOME/bin/crsctl
DISKMON=$ORA_CRS_HOME/bin/diskmon
# default diagnostic collection script
OPROCD_DIAGSCRIPT=$ORA_CRS_HOME/bin/oprocd_diag
# Temp file for crsctl output
CRSCTLOUT=/tmp/crsctl.$$
# indicates that the key doesnt exist in OCR
CRSCTL_KEY_UNDEFINED=12
# Default path for SCR control files.
SCRDIR=/var/opt/oracle/scls_scr/$HOST
# Directory for OPROCD logfiles
OPROCDIR=/var/opt/oracle/oprocd
# Command to make a process run in realtime
REALTIME_PID=
# How long to sleep in startcheck to cover asynchronous startups of things like
# networks, disks, and filesystems not readily checked by crsctl. This time should
# be 0 except in extenuating circumstances.
STARTCHECKSLEEP=0
# Rate at which we recheck the flag files for a manual startup, after
# deciding not to start.
RUNRECHECKTIME=30
# Defines for the priority boost mechanism
PRIORITY_BOOST_DISABLED=0
PRIORITY_BOOST_LOW=1
PRIORITY_BOOST_MID=2
PRIORITY_BOOST_HIGH=3
PRIORITY_BOOST_REALTIME=4
# If a platform wants to override usage of priority boost functionality
# that platform should override PRIORITY_BOOST_DEFAULT in the platform
# specific section below.
PRIORITY_BOOST_DEFAULT=$PRIORITY_BOOST_HIGH
# How long to wait (in seconds) before rechecking a dependency,
# and printing out messages about it.
DEP_CHECK_WAIT=60
#ulimit set to unlimited
ULIMIT_CORE="ulimit -c unlimited"
#Check if SUBSYSFILE is created
CHECK_SUBSYSFILE=""
PLATFORM=`$UNAME`
MAXFILE=65536
case $PLATFORM in
Linux)
# Presence of this file indicates that vendor clusterware is installed
# And on Linux, we don't support any vendor clusterware.
SKGXNLIB=$ORA_CRS_HOME/lib/INVALID_DIRECTORY
# touch /var/lock/subsys/init.crs so that the shutdown
# scripts get called during shutdown time (refer bug 4997126)
SUBSYSFILE="/var/lock/subsys/init.crs"
if [ ! -f $TEST ]; then
TEST=/usr/bin/test
fi
if [ -f $SKGXNLIB ]; then
USING_VC=1
fi
LD_LIBRARY_PATH=$ORA_CRS_HOME/lib
export LD_LIBRARY_PATH
HEAD='/usr/bin/head'
# Use runuser on systems which have SElinux, to avoid
# interactive scripts when su is used.
if [ -f "/sbin/runuser" ]; then
SU="/sbin/runuser -l"
else
SU="/bin/su -l"
fi
# Over-ride SCRDIR
SCRDIR=/etc/oracle/scls_scr/$HOST
# Command to make a process run in realtime
REALTIME_CMD=/usr/bin/chrt
if [ ! -f $REALTIME_CMD ]; then
REALTIME_CMD=/bin/chrt
fi
if [ -x $REALTIME_CMD ]; then
REALTIME_PID="$REALTIME_CMD -r -p 99"
fi
USING_DISKMON='true' # using diskmon on this platform
CLINFO=/bin/true
if [ $USING_VC -eq 1 ]; then
# We are using PrimeCluster as vendor clusterware
SLOW_REBOOT="/usr/bin/pkill -HUP syslogd ; /bin/sync & /bin/sleep 2; /sbin/reboot -n -f"
FAST_REBOOT="$ECHO b > /proc/sysrq-trigger"
VC_UP=/bin/true # No known way to detect the clusterware via PS
VC_NAME="PrimeCluster"
else
# No valid vendor clusterware
FAST_REBOOT="$ECHO b > /proc/sysrq-trigger"
VC_UP=/bin/true
VC_NAME=""
fi
ID=/etc/init.d
LOGGER="/usr/bin/logger"
if [ ! -f "$LOGGER" ];then
LOGGER="/bin/logger"
fi
LOGMSG="$LOGGER -puser.err"
LOGERR="$LOGGER -puser.alert"
RENICE="/usr/bin/renice"
OPROCDIR=/etc/oracle/oprocd
# Enable kernel sysrqs so that FAST_REBOOT can run. Occasionally
# a user will run init.cssd as non-root. Avoid the error message
# by confirming the userid first.
MYID=`/usr/bin/id -u`
if [ "$MYID" = "0" ]; then
$ECHO 1 > /proc/sys/kernel/sysrq
# Don't get timezone when the stack is not up
RUNFILE=$SCRDIR/root/cssrun
RUNID=
if [ -r $RUNFILE ]; then
RUNID=`$CAT $RUNFILE`
fi
# if RUNFILE not readable, RUNID will be null
if [ "norun" != "$RUNID" ]; then
$SU $ORACLE_USER -c "$ECHO \$TZ > /tmp/oratz.$$ " > /dev/null 2>&1
if [ -f "/tmp/oratz.$$" ]; then
NEWTZ=`$SED 's/^[ \t]*//;s/[ \t]*$//' < /tmp/oratz.$$`
$RMF /tmp/oratz.$$
fi
if [ ! -z "$NEWTZ" ]; then
TZ=$NEWTZ;
export TZ;
fi
fi
fi
# Make the CSSD run realtime by default
PRIORITY_BOOST_DEFAULT=$PRIORITY_BOOST_REALTIME
# See discussion in LocalFence
REBOOTLOCKFILE=/var/tmp/.orarblock
CLEANREBOOTLOCK="$RMF $REBOOTLOCKFILE"
# We are trying to get a timestamp of when the machine booted. It
# appears that access time on /proc will do this, even if it looks odd.
GETBOOTID="eval $LS -ld --full-time /proc | $AWK '{print \$6\$7\$8\$9\$10;}'"
DIRNAME=/usr/bin/dirname
XARGS=/usr/bin/xargs
$SU $ORACLE_USER -c "$ECHO \$TZ > /tmp/oratz.$$ " > /dev/null 2>&1
NEWTZ=`$SED 's/^[ \t]*//;s/[ \t]*$//' < /tmp/oratz.$$`
$RMF /tmp/oratz.$$
if [ ! -z "$NEWTZ" ]; then
TZ=$NEWTZ;
export TZ;
fi
# Delay node fence invoked by oclsomon by 1 second on Linux.
OMONSLEEP="$SLEEP 1"
;;
HP-UX) MACH_HARDWARE=`/bin/uname -m`
CLUSTERDIR=/opt/nmapi/nmapi2
if [ "$MACH_HARDWARE" = "ia64" ]; then
SO_EXT=so
NMAPIDIR_64=$CLUSTERDIR/lib/hpux64
else
SO_EXT=sl
NMAPIDIR_64=$CLUSTERDIR/lib/pa20_64
fi
LD_LIBRARY_PATH=$ORA_CRS_HOME/lib:$NMAPIDIR_64:/usr/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
# Presence of this file indicates that vendor clusterware is installed
SKGXNLIB=${NMAPIDIR_64}/libnmapi2.${SO_EXT}
if [ -f $SKGXNLIB ]; then
USING_VC=1
fi
VC_UP="$PSEF | $GREP '/usr/lbin/cm[g]msd' 1>$NULL 2>$NULL"
# NOTE: Not supporting Hardware partitioning machines.
REBOOT_TOC="/var/opt/oracle/bin/reboot_toc"
FAST_REBOOT="$REBOOT_TOC || /usr/sbin/reboot -r -n -q"
SLOW_REBOOT="/bin/kill -HUP `$CAT /var/run/syslog.pid` ; /bin/sync & $SLEEP 2 ; $REBOOT_TOC || /usr/sbin/reboot -r -n -q"
DFL_CLSINFO=$CLUSTERDIR/bin/clsinfo
if [ $USING_VC -eq 0 ]; then
# We are not using vendor clusterware.
VC_NAME=""
VC_UP=/bin/true
CLINFO=/bin/true
FAST_REBOOT="$REBOOT_TOC || /usr/sbin/reboot -r -n -q"
SLOW_REBOOT="$REBOOT_TOC || /usr/sbin/reboot -r -n -q"
elif [ -f $DFL_CLSINFO ]; then
# We are using Generic HP Vendor Clusterware
VC_NAME="Generic HP-UX Vendor Clusterware"
VC_UP=/bin/true
CLINFO=$DFL_CLSINFO
else
# We are using HPUX ServiceGuard Clusterware
VC_NAME="HP-UX Service Guard"
CLINFO=/bin/true
fi
ID=/sbin/init.d
LVINFO=/usr/sbin/lvdisplay
VGINFO=/usr/sbin/vgdisplay
VG_ACTIVATE="/usr/sbin/vgchange -a s"
VG_DEACTIVATE="/usr/sbin/vgchange -a n"
GETBOOTID="/bin/who -b"
RENICE='/usr/bin/renice -n '
DIRNAME=/bin/dirname
UNIX95=true
export UNIX95
# Make the CSSD run realtime by default
PRIORITY_BOOST_DEFAULT=$PRIORITY_BOOST_REALTIME
USING_DISKMON='true' # using diskmon on this platform
# Command to make a process run in realtime
REALTIME_CMD=/usr/bin/rtprio
if [ ! -f $REALTIME_CMD ]; then
REALTIME_CMD=/bin/rtprio
fi
if [ -x $REALTIME_CMD ]; then
REALTIME_PID="$REALTIME_CMD 127"
fi
;;
SunOS) MACH_HARDWARE=`/bin/uname -i`
ARCH=`/usr/bin/isainfo -b`
CLUSTERDIR=/opt/ORCLcluster
LD_LIBRARY_PATH=$ORA_CRS_HOME/lib:$CLUSTERDIR/lib:/usr/lib:/usr/ucblib:$LD_LIBRARY_PATH
LD_LIBRARY_PATH_64=$ORA_CRS_HOME/lib:$CLUSTERDIR/lib:/usr/lib:/usr/ucblib:$LD_LIBRARY_PATH_64
if [ "${MACH_HARDWARE}${ARCH}" = "i86pc64" ]; then
LD_LIBRARY_PATH=$ORA_CRS_HOME/lib:$CLUSTERDIR/lib:/usr/lib/amd64:/usr/ucblib/amd64:$LD_LIBRARY_PATH
LD_LIBRARY_PATH_64=$ORA_CRS_HOME/lib:$CLUSTERDIR/lib:/usr/lib/amd64:/usr/ucblib/amd64:$LD_LIBRARY_PATH_64
fi
export LD_LIBRARY_PATH
export LD_LIBRARY_PATH_64
# Presence of this file indicates that vendor clusterware is installed
SKGXNLIB=$CLUSTERDIR/lib/libskgxn2.so
if [ -f $SKGXNLIB ]; then
USING_VC=1
fi
# Define some variables based on the presence of vendor clusterware.
DFL_CLSINFO=$CLUSTERDIR/bin/clsinfo
if [ $USING_VC -eq 0 ]; then
# We are not using vendor clusterware.
SLOW_REBOOT="/sbin/uadmin 1 1"
FAST_REBOOT="/sbin/uadmin 1 1"
VC_UP=/bin/true
CLINFO=/bin/true
VC_NAME=""
elif [ -f $DFL_CLSINFO ]; then
# We are using vendor clusterware other than Sparc64 SunCluster
SLOW_REBOOT="/bin/pkill -HUP syslogd ; /bin/sync & /bin/sleep 2; /sbin/uadmin 5 1"
FAST_REBOOT="/sbin/uadmin 1 1"
CLINFO=$DFL_CLSINFO
VC_UP=/bin/true # No known way to detect the clusterware via PS
VC_NAME="Generic SunOS Vendor Clusterware"
else
# We are using SunCluster as vendor clusterware
SLOW_REBOOT="/bin/pkill -HUP syslogd ; /bin/sync & /bin/sleep 2; /bin/pkill -TERM ucmmd ; /bin/sleep 35 ; /sbin/uadmin 5 1"
FAST_REBOOT="/sbin/uadmin 1 1"
CLINFO=/usr/sbin/clinfo
VC_UP="$PSE -u 0 | $GREP 'ucm[m]d' 1>$NULL 2>$NULL"
if [ "$MACH_HARDWARE" = "i86pc" ]; then
SLOW_REBOOT="/bin/pkill -HUP syslogd ; /bin/sync & /bin/sleep 2; /bin/pkill -TERM ucmmd ; /bin/sleep 45 ; /sbin/uadmin 5 1"
VC_NAME="SunCluster on x86"
else
VC_NAME="SunCluster on Sparc"
fi
fi
ID=/etc/init.d
GETBOOTID="/bin/who -b"
DIRNAME=/bin/dirname
FINDCLSVMON="$PS -e -o fname,pid | $GREP '^oclsvmon'"
FINDCLSOMON="$PS -e -o fname,pid | $GREP '^oclsomon'"
FINDDISKMON="$PS -e -o fname,pid | $GREP '^diskmon'"
FINDCSSD="$PS -e -o fname,pid | $GREP '^ocssd'"
# Make the CSSD run realtime by default
PRIORITY_BOOST_DEFAULT=$PRIORITY_BOOST_REALTIME
# Command to make a process run in realtime
REALTIME_CMD=/usr/bin/priocntl
if [ ! -f $REALTIME_CMD ]; then
REALTIME_CMD=/bin/priocntl
fi
if [ -x $REALTIME_CMD ]; then
# RT priority at 110 for Solaris
REALTIME_PID="$REALTIME_CMD -s -c RT -p 10 -i pid"
fi
;;
AIX) CLUSTERDIR=/opt/ORCLcluster
LIBPATH=$ORA_CRS_HOME/lib:$CLUSTERDIR/lib:/usr/lib:$LIBPATH
export LIBPATH
RENICE="/usr/sbin/renice"
FAST_REBOOT="/usr/bin/sysdumpstart -p"
SLOW_REBOOT="/bin/kill -HUP `$CAT /etc/syslog.pid`; /bin/sync & $SLEEP 2; /usr/sbin/fastboot -n -q"
# Presence of this file indicates that vendor clusterware is installed
SKGXNLIB=/usr/sbin/cluster/utilities/cldomain
if [ -f $SKGXNLIB ]; then
USING_VC=1
fi
# Over-ride SCRDIR
OPROCDIR=/etc/oracle/oprocd
SCRDIR=/etc/oracle/scls_scr/$HOST
VC_UP="$PSEF | $GREP 'ha[g]sd' | $GREP '[g]rpsvcs' 1>$NULL 2>$NULL"
# NOTE: If RPD happens to get supported later, modify clustername
# accordingly
DFL_CLSINFO=$CLUSTERDIR/bin/clsinfo
if [ $USING_VC -eq 0 ]; then
# We are not using vendor clusterware.
VC_NAME=""
VC_UP=/bin/true
CLINFO=/bin/true
FAST_REBOOT="/usr/bin/sysdumpstart -p"
SLOW_REBOOT="/usr/bin/sysdumpstart -p"
elif [ -f $DFL_CLSINFO ]; then
# We are running Generic Clusterware
VC_NAME="Generic AIX Vendor Cluster"
CLINFO=$DFL_CLSINFO
VC_UP=/bin/true
else
# We are running AIX HACMP
VC_NAME="AIX HACMP Vendor Clusterware"
VC_UP=/bin/true
CLINFO=/bin/false
USING_VC=0
fi
ID=/etc
LVINFO=/usr/sbin/lslv
VGINFO=/usr/sbin/lsvg
VG_ACTIVATE="/etc/varyonvg -c"
VG_DEACTIVATE="/etc/varyoffvg"
GETBOOTID="/bin/who -b"
DIRNAME=/bin/dirname
# Make the CSSD run realtime by default
PRIORITY_BOOST_DEFAULT=$PRIORITY_BOOST_REALTIME
# Command to make a process run in higher priority
OPRIPROC=opriproc
OPRIPROC_DIR="/etc/oracle/bin"
if [ -f "$OPRIPROC_DIR/$OPRIPROC" ]; then
REALTIME_CMD="$OPRIPROC_DIR/$OPRIPROC"
else
REALTIME_CMD=$RENICE
fi
if [ -x "$OPRIPROC_DIR/$OPRIPROC" ]; then
REALTIME_PID="$OPRIPROC_DIR/$OPRIPROC -p "
elif [ -x $REALTIME_CMD ]; then
REALTIME_PID="$REALTIME_CMD -20"
fi
;;
OSF1) LD_LIBRARY_PATH=$ORA_CRS_HOME/lib:/usr/lib
export LD_LIBRARY_PATH
FAST_REBOOT="/usr/sbin/reboot -n -q"
SLOW_REBOOT="/bin/kill -HUP `$CAT /var/run/syslog.pid`; /bin/sync & $SLEEP 2 ; /usr/sbin/reboot -n -q"
# No need for OPROCD on Tru64. We don't support a configuration
# without Tru64 clusterware, AND, Tru64 clusterware is responsible
# for I/O Fencing.
DISABLE_OPROCD=true
# Presence of this file indicates that vendor clusterware is installed
SKGXNLIB=/usr/ccs/lib/libdlm.a
if [ -f $SKGXNLIB ]; then
USING_VC=1
fi
VC_UP=/bin/true
VC_NAME="TruCluster"
CLINFO=/bin/true
ID=/sbin/init.d
GETBOOTID="/bin/who -b"
DIRNAME=/usr/bin/dirname
MAXFILE=unlimited
;;
*) /bin/echo "ERROR: Unknown Operating System"
exit -1
;;
esac
OPROCDLOG=$OPROCDIR/$HOST.oprocd.log
OPROCDLGL=$OPROCDIR/$HOST.oprocd.lgl
# If no immediate reboot specified, use FAST_REBOOT
if [ -z "$SLOW_REBOOT" ]
then
SLOW_REBOOT=$FAST_REBOOT
fi
# These six files contain system settings used for controlling CSS, and CRS.
AUTOSTARTFILE=$SCRDIR/root/crsstart
FATALFILE=$SCRDIR/$ORACLE_USER/cssfatal
NOCLSVMON=$SCRDIR/root/noclsvmon
NOCLSOMON=$SCRDIR/root/noclsomon
NOOPROCD=$SCRDIR/root/nooprocd
RUNFILE=$SCRDIR/root/cssrun
CLSVMONPIDFILE=$SCRDIR/root/clsvmonpid
CLSOMONPIDFILE=$SCRDIR/root/clsomonpid
DAEMONPIDFILE=$SCRDIR/root/daemonpid
OPROCDPIDFILE=$SCRDIR/root/oprocdpid
DISKMONPIDFILE=$SCRDIR/root/oprocdpid
CSSFBOOT=$SCRDIR/root/cssfboot
NODISKMON=$SCRDIR/root/nodiskmon # start diskmon or not
DISKMONUSED=$SCRDIR/$ORACLE_USER/diskmonused # use diskmon or not
# This function is applicable only on Linux flavors
createSUBSYSFILE()
{
if [ "$PLATFORM" = "Linux" ] ; then
# touch /var/lock/subsys/init.crs so that the shutdown
# scripts get called during shutdown time (refer bug 4997126)
if [ "$CHECK_SUBSYSFILE" == "" ]; then
$TOUCH $SUBSYSFILE
CHECK_SUBSYSFILE=1
fi
fi
}
validateORACLE_USER()
{
ret=0;
case $PLATFORM in
Linux)
;;
HP-UX)
;;
SunOS)
;;
AIX)
LSUSER=/usr/sbin/lsuser
CHUSER=/usr/bin/chuser
SED=/usr/bin/sed
USER=$ORACLE_USER
CURRENT_CAPABILITIES=`$LSUSER -a capabilities $USER | $SED -e "s-$USER--g" -e "s-.*=--" -e "s-,- -g"`
REQUIRED_CAPABILITIES="CAP_NUMA_ATTACH CAP_BYPASS_RAC_VMM CAP_PROPAGATE"
NEEDED_CAPABILITIES=""
for capabilities in $REQUIRED_CAPABILITIES
do
if [ `$ECHO $CURRENT_CAPABILITIES | $GREP -w -q $capabilities; $ECHO $?` -ne 0 ];then
NEEDED_CAPABILITIES="$capabilities $NEEDED_CAPABILITIES"
fi
done
if [ ! -z "$NEEDED_CAPABILITIES" ]; then
$LOGERR "INIT.CSSD Failure. Change <$USER> userid to have the following OS capabilities :"\
"<$CURRENT_CAPABILITIES $NEEDED_CAPABILITIES> by running <$CHUSER> command."
ret=1;
fi
;;
*)
;;
esac
return $ret;
}
# Initialize diagnositic collection system if any exists on the system
StartDiagCollect()
{
# we only need to start diagnostic collection if the diagcollect script
# exists on the users system, otherwise we skip it
if [ -f $OPROCD_DIAGSCRIPT ]; then
$OPROCD_DIAGSCRIPT start > $NULL 2>&1 &
OPROCD_DIAGSCRIPT_PID=$!
fi
}
# Termination of the diagnostic collection system
StopDiagCollect()
{
if [ ! -z "$OPROCD_DIAGSCRIPT_PID" ]; then
$OPROCD_DIAGSCRIPT stop $OPROCD_DIAGSCRIPT_PID > $NULL 2>&1
fi
}
# Define the reboot action which will be used to prevent IO from the local
# node from corrupting the database.
LocalFence()
{
# We want to reboot here as fast as possible. It is imperative
# that we do not flush any IO to the shared disks. Choosing not
# to flush local disks or kill off processes gracefully shuts
# us down quickly. But there are a couple cases that allow us to go
# down more gracefully as outlined below.
case `$CAT $FATALFILE` in
disable*)
# No reboot action is necessary at this time. We have not finished
# the install and allowed database activity to start.
REBOOT_CMD="$SLEEP 1"
;;
*)
$LOGERR "Oracle CRS failure. Rebooting for cluster integrity."
# If there is no vendor clusterware, then we do not have a slow reboot
# mechanism.
if [ -r "$SKGXNLIB" ]; then
READABLE_SKGXN=1
else
READABLE_SKGXN=0
fi
if [ $USING_VC -eq 0 -o $READABLE_SKGXN -eq 0 ]; then
REBOOT_CMD="$FAST_REBOOT"
else
# is clsvmon up?
VMONUP=`$EVAL $FINDCLSVMON`
# is vendor clusterware alive?
$EVAL $VC_UP
RC=$?
# If vmon is down and vendor clusterware is up, then the other node
# is about to evict us, and we should kill the node quickly.
if [ -z "$VMONUP" ] && [ "$RC" = "0" ]; then
REBOOT_CMD="$FAST_REBOOT"
else
REBOOT_CMD="$SLOW_REBOOT"
fi
fi
;;
esac
# If diagwait is set, $SYNCSLEEP should be greater than 0, so
# we can sync and sleep a small amount to get better diagnostics.
if [ $SYNCSLEEP -gt 0 ]; then
$SYNC&
$SLEEP $SYNCSLEEP
fi
# Workaround to Redhat 3 issue with multiple invocations of reboot.
# Here if oclsomon and ocssd are attempting a reboot at the same time
# then the kernel could lock up. Here we have a crude lock which
# doesn't eliminate but drastically reduces the likelihood of getting
# two reboots at once.
if [ "$PLATFORM" = "Linux" ]; then
CEDETO=
if [ -e "$REBOOTLOCKFILE" ]; then
CEDETO=`$CAT $REBOOTLOCKFILE`
fi
$ECHO $$ > $REBOOTLOCKFILE
if [ ! -z "$CEDETO" ]; then
REBOOT_CMD="$SLEEP 0"
$LOGMSG "Oracle init script ceding reboot to sibling $CEDETO."
fi
fi
$EVAL $REBOOT_CMD
$SLEEP 120
}
# Priority boost is only applied to the CSS daemon, invoked by one of these two actions.
if [ $1 = 'daemon' ] || [ $1 = 'run' ] || [ $1 = 'diag' ]; then
# since we got the node name, now try to get the actual
# boost value for the node
PRIORITY_BOOST_VALUE=`$CRSCTL get css priority`
RC=$?
# be sure to check if we hit any errors
case $RC in
0)
# no errors, all things are good
;;
$CRSCTL_KEY_UNDEFINED)
# if we get back an error saying the value wasn't there,
# then we can just assume the default
PRIORITY_BOOST_VALUE=$PRIORITY_BOOST_DEFAULT
;;
*)
# for any other errors we still assume the defaults
PRIORITY_BOOST_VALUE=$PRIORITY_BOOST_DEFAULT
;;
esac
fi
# Get appropriate values for diagwait and reboottime
if [ $1 = 'daemon' ] || [ $1 = 'oprocd' ] || [ $1 = 'oclsomon' ]; then
# Get diagwait value
DIAGWAIT=`$CRSCTL get css diagwait`
RC=$?
if [ "$RC" != "0" ]; then # No diagwait set
DIAGWAIT=0
fi
# Get reboottime value. A value is always returned
REBOOTTIME=`$CRSCTL get css reboottime`
if [ $DIAGWAIT -gt $REBOOTTIME ]; then
# Max time we can sleep waiting for a sync to complete
SYNCSLEEP=`$EXPRN $DIAGWAIT - $REBOOTTIME`
# Relax oprocd margin to allow for poor scheduling
OPROCD_DEFAULT_MARGIN=`$EXPRN $SYNCSLEEP \* 1000`
# Calculate 500 ms and 1000 ms offsets based on OPROCD_DEFAULT_MARGIN
OPROCD_HISTOGRAM_BASE_500=`$EXPRN 500 \* 100 / $OPROCD_DEFAULT_MARGIN`
OPROCD_HISTOGRAM_BASE_1000=`$EXPRN 1000 \* 100 / $OPROCD_DEFAULT_MARGIN`
OPROCD_DEFAULT_HISTOGRAM="-hsi $OPROCD_HISTOGRAM_BASE_500:$OPROCD_HISTOGRAM_BASE_1000:50:75:90"
else
# do not print error msg if not set
if [ $DIAGWAIT -gt 0 ]; then
$LOGERR "INIT.CSSD ERROR: Diagwait set to $DIAGWAIT, must be"\
"greater than reboottime of $REBOOTTIME"
$LOGERR "INIT.CSSD ERROR: diagwait option disabled"
$LOGERR "INIT.CSSD ERROR: Use '$CRSCTL set css diagwait N' to correct"
fi
fi
fi
# This will be consumed by the CSS daemon binary later
export PRIORITY_BOOST_VALUE
# Validate ORACLE_USER
validateORACLE_USER || { $ECHO $?; exit 1; }
case $1 in
'home')
$ECHO $ORA_CRS_HOME
exit 0;
;;
'user')
$ECHO $ORACLE_USER
exit 0;
;;
'diag')
$ECHO CRS init script diagnostics.
$ECHO TZ=$TZ
$ECHO LANG=$LANG
$ECHO USER=$ORACLE_USER
$ECHO HOME=$ORA_CRS_HOME
$ECHO AUTO=`$CAT $AUTOSTARTFILE`
$ECHO RUNID=`$CAT $RUNFILE`
$ECHO BOOTID=`$ID/init.cssd bootid`
$ECHO FATAL=`$CAT $FATALFILE`
$ECHO SCS=$STARTCHECKSLEEP
$ECHO RCT=$RUNCHECKTIME
$ECHO PRIORITY_BOOST_VALUE=$PRIORITY_BOOST_VALUE
if [ -f "$SKGXNLIB" ]; then
$ECHO VC=Yes
else
$ECHO VC=No
fi
if [ -f "$NOCLSVMON" ]; then
$ECHO CLSV=No
else
$ECHO CLSV=Yes
fi
if [ -f "$NOCLSOMON" ]; then
$ECHO CLSO=No
else
$ECHO CLSO=Yes
fi
if [ -f "$NOOPROCD" ]; then
$ECHO OPROC=No
else
$ECHO OPROC=Yes
fi
if [ -f "$NODISKMON" ]; then
$ECHO DISKMON=No
else
$ECHO DISKMON=Yes
fi
exit 0;
;;
'bootid')
# Set a null timezone. Some implementations of GETBOOTID are sensitive
# to the timezone in the multiple environments this can get invoked from.
TZ=
export TZ
# Set a null language id. GETBOOTID can also be sensitive to the language
# codes, when init.cssd is run in a user shell compared to being run
# under init. Setting a blank language code should guarantee consistency.
LANG=
export LANG
$GETBOOTID
exit 0;
;;
'disable')
# Disable the CSS daemon from starting at boot time.
$ECHO "Automatic startup disabled for system boot."
$ECHO disable > $AUTOSTARTFILE
exit 0;
;;
'enable')
# Enable automatic CSS startup at boot time.
$ECHO "Automatic startup enabled for system boot."
$ECHO enable > $AUTOSTARTFILE
exit 0;
;;
'norun')
# Mark the norun flag to disable any daemons from restarting.
$ECHO "norun" > $RUNFILE
exit 0;
;;
'start')
CMD=`$BASENAME $0`
# If we are being invoked by the user, perform manual startup.
# If we are being invoked as an RC script, check for autostart.
if [ "$CMD" = "init.cssd" ]; then
$LOGMSG "Oracle Cluster Synchronization Service starting by user request."
$ID/init.cssd manualstart
else
$ID/init.cssd autostart
fi
;;
'manualstart')
# Create lock file SUBSYSFILE
createSUBSYSFILE;
# Queue a startup to the CRS scripts invoked by inittab.
BOOTID=`$ID/init.cssd bootid`
$ECHO "$BOOTID" > $RUNFILE
STARTTIME=`$EXPRN $RUNRECHECKTIME + $STARTCHECKSLEEP`
$ECHO "Startup will be queued to init within $STARTTIME seconds."
;;
'autostart')
# Create lock file SUBSYSFILE
createSUBSYSFILE;
# Check to see whether the user has enabled automatic startup.
# Is the flag file still there?
if [ -r $AUTOSTARTFILE ]
then
case `$CAT $AUTOSTARTFILE` in
disable*)
$LOGMSG "Oracle Cluster Ready Services disabled by administrator."
$ID/init.cssd norun
;;
enable*)
# Continue on to the next check
$LOGMSG "Oracle Cluster Ready Services starting up automatically."
$ID/init.cssd manualstart
;;
*)
$LOGERR "Oracle Cluster Ready Services disabled by damaged install."
$LOGERR " Unexpected settings found in $AUTOSTARTFILE."
$ID/init.cssd norun
;;
esac
else
# If the SCR directory does not exist, then either the user changed
# their hostname, or they wiped sections of the disk. Give them a
# slightly less frightening message.
if [ ! -d "$SCRDIR" ]
then
$LOGERR Oracle Cluster Ready Services startup disabled.
$LOGERR Did the hostname change? Could not access $AUTOSTARTFILE.
else
$LOGERR Oracle Cluster Ready Services is disabled by damaged install.
$LOGERR Could not access $AUTOSTARTFILE.
fi
$ID/init.cssd norun
fi
exit 0;
;;
# Runcheck is intended to check the run status for any of the
# run or fatal scripts (evm/crs/css) as initialized by the automatic startup
# or manual startup routines.
# Runcheck is supposed to be a very fast check, and be silent since it
# will get invoked regularly while the system is up.
# Exit codes should match the requirements of startcheck.
'runcheck')
if [ ! -r "$RUNFILE" ]; then
# If this file does not exist, then the automatic startup checks
# in the "start" target will warn the user of problems.
exit 3;
fi
BOOTID=`$ID/init.cssd bootid`
RUNID=`$CAT $RUNFILE`
if [ "$BOOTID" != "$RUNID" ]; then
if [ "$RUNID" = "startstack" ]; then
$ID/init.cssd manualstart
else
# We do not have clearance to start up. So respect that authority.
# Nothing needs to be logged in this case.
exit 3;
fi
fi
exit 0;
;;
# Startcheck is intended to check the run status for any of the
# run or fatal scripts (evm/crs/css) (see runcheck), and additionally
# check on vendor clusterware and filesystem dependencies.
# Startcheck is supposed to block for a long time waiting on dependencies.
'startcheck') # Returns 0 if we should start
# Returns 1 on a non-cluster boot
# Returns 2 if disabled by admin
# Returns 3 on error
# Check our startup run status, initialized by the automatic startup
# or manual startup routes.
$ID/init.cssd runcheck
STATUS=$?
if [ "$STATUS" != "0" ]; then
exit $STATUS;
fi
# If we have vendor clusterware, and CLINFO indicates a non-clustered boot
# then prevent CRS startup.
if [ $USING_VC -eq 1 ]
then
# Run CLINFO to get cluster status. It returns 0 if the machine is
# booting in clustered mode.
$EVAL $CLINFO
if [ "$?" != "0" ]; then
$LOGMSG "Oracle Cluster Ready Services disabled by non-clustered boot."
$ID/init.cssd norun
exit 1;
fi
# Wait for the Vendor Clusterware to start
$EVAL $VC_UP
RC=$?
while [ $RC -ne 0 ]; do
$LOGMSG "Oracle Cluster Ready Services waiting for $VC_NAME to start."
$SLEEP $DEP_CHECK_WAIT
$EVAL $VC_UP
RC=$?
done
fi
# Wait until it is safe to start CRS daemons
while [ ! -r $CRSCTL ]
do
$LOGMSG "Waiting for filesystem containing $CRSCTL."
$SLEEP $DEP_CHECK_WAIT
done
# Now bring up the OCR, Voting Disk Volume Group(s), but only if we are
# called by the CSS startup
if [ "$2" = "CSS" ]
then
$SLEEP 0 # do nothing for now.
fi
# Wait for additional filesystems and objects to become available
# crsctl should print out a message indicating cause of failure.
$SU $ORACLE_USER -c "$CRSCTL check boot > $CRSCTLOUT"
RC=$?
while [ "$RC" != "0" ]
do
$LOGMSG Cluster Ready Services waiting on dependencies. Diagnostics in $CRSCTLOUT.
$SLEEP $DEP_CHECK_WAIT
$SU $ORACLE_USER -c "$CRSCTL check boot > $CRSCTLOUT"
RC=$?
done
# Finished waiting on dependencies. Diagnostics are no longer necessary.
$LOGMSG Cluster Ready Services completed waiting on dependencies.
$RMF $CRSCTLOUT
# Some platforms may need additional sleeps to be done here in
# rare circumstances.
$SLEEP $STARTCHECKSLEEP
# all good
exit 0;
;;
'oclsomon')
# This action is expected to start and monitor the clsomon daemon.
# Its purpose is to assist the CSS daemon by monitoring it for hangs.
# In the event of a CSS daemon hang, the remote nodes may evict the
# current node and so it is necessary to terminate the local node.
# On rare occasion this will get re-invoked while a shutdown is
# in progress. If so, this script should exit.
$ID/init.cssd runcheck
if [ "$?" != "0" ]; then
exit 0;
fi
# Arguments. By default none.
CLSOMON_ARGS=
# Run clsomon out of its own directory in case it drops a core
CLSOMONDIR=$ORA_CRS_HOME/log/$HOST/cssd/oclsomon
# Backup the oclsomon logfiles
$MVF $CLSOMONDIR/oclsomon.ba4 $CLSOMONDIR/oclsomon.ba5
$MVF $CLSOMONDIR/oclsomon.ba3 $CLSOMONDIR/oclsomon.ba4
$MVF $CLSOMONDIR/oclsomon.ba2 $CLSOMONDIR/oclsomon.ba3
$MVF $CLSOMONDIR/oclsomon.ba1 $CLSOMONDIR/oclsomon.ba2
$MVF $CLSOMONDIR/oclsomon.log $CLSOMONDIR/oclsomon.ba1
if [ ! -d "$CLSOMONDIR" ]; then
$MKDIRP $CLSOMONDIR
$CHOWN $ORACLE_USER $CLSOMONDIR
fi
# If we can set ourselves into realtime, do so, otherwise renice
# ourselves, and the child scripts. This is useful to ensure
# that we can perform the fence action if CSS kills itself due to
# unreasonable load. This script and oclsomon will remain asleep
# most of the time so a high priority shouldn't bother anything.
if [ "$REALTIME_PID" != "" ]; then
case $PLATFORM in
HP-UX)
$REALTIME_PID -$$
;;
*)
$REALTIME_PID $$
;;
esac
else
$RENICE -5 $$
fi
$SU $ORACLE_USER -c \
"/bin/sh -c 'cd $CLSOMONDIR; $ULIMIT_CORE; $ORA_CRS_HOME/bin/oclsomon $CLSOMON_ARGS || exit \$?'"
RC=$?
# What kind of return code have we received?
case "$RC" in
# Graceful shutdown
0)
$LOGMSG "Oracle clsomon shutdown successful."
$TOUCH $NOCLSOMON
exit 0;
;;
# oclsomon is already up. Restart it.
56)
$EVAL $FINDCLSOMON | $AWK '{ print $2 ; }' | $XARGS $KILLTERM > $NULL 2>&1
$LOGMSG "Duplicate clsomon found. Restarting."
exit 0;
;;
# Initialization errors
4*|5*|6*)
$LOGMSG "Oracle clsomon startup failed with status $RC. Restarting."
$SLEEP 5
exit 0;
;;
# Steady state errors.
# note: segfault and signals may have status 130+, which falls under 1*
1*|2*|3*)
$LOGMSG "Oracle clsomon failed with fatal status $RC."
$EVAL $OMONSLEEP
LocalFence;
$ID/init.cssd norun
exit 0;
;;
# Unknown error
*)
$LOGMSG "Oracle clsomon failed with unexpected status $RC."
$EVAL $OMONSLEEP
LocalFence;
$ID/init.cssd norun
exit 0;
esac
# all good.
exit 0;
;;
'oclsvmon')
# This action is expected to start and monitor the clsvmon daemon.
# Its purpose is to assist the CSS daemon in monitoring vendor clusterware
# and allow additional diagnostics to be obtained in the case of system
# failures.
# On rare occasion this will get re-invoked while a shutdown is
# in progress. If so, this script should exit.
$ID/init.cssd runcheck
if [ "$?" != "0" ]; then
exit 0;
fi
# Arguments. By default none.
CLSVMON_ARGS=
# Run clsvmon out of its own directory in case it drops a core
CLSVMONDIR=$ORA_CRS_HOME/log/$HOST/cssd/oclsvmon
if [ ! -d "$CLSVMONDIR" ]; then
$MKDIRP $CLSVMONDIR
$CHOWN $ORACLE_USER $CLSVMONDIR
fi
$SU $ORACLE_USER -c \
"/bin/sh -c 'cd $CLSVMONDIR; $ULIMIT_CORE; $ORA_CRS_HOME/bin/oclsvmon $CLSVMON_ARGS || exit \$?'"
RC=$?
# what kind of return code have we received?
case "$RC" in
# CLSVMON will return a status code of 15 if it has seen a failure in
# a stable CSS group. This can happen for several reasons, but the most
# interesting of these is when an IO freeze causes the daemon to lock up.
# In this case, this codepath is the only one available for killing the
# machine before the rest of the cluster evicts us.
15)
$LOGMSG "Oracle CSS daemon detected IO freeze to its voting disks."
$EVAL $FAST_REBOOT
$TOUCH $NOCLSVMON
exit 0;
;;
# CLSVMON will return a status code of 9 if it has received a TERM signal.
# TERM signal will either be caused by init when we are shutting down,
# or be caused by the graceful shutdown script. In either case, this
# monitor script has nothing left to do, and no log message is warranted.
9)
$TOUCH $NOCLSVMON
exit 0;
;;
# CLSVMON will return a status code of 11 if it has a failure in
# a vendor clusterware API. Retry.
11)
$LOGMSG "Oracle CLSVMON was unable to interact with vendor clusterware. Retrying"
$RMF $NOCLSVMON
exit 1;
;;
# CLSVMON will return a status code of 13 if it is unable to find
# vendor clusterware. Do not retry.
# The clsvmon part of init.cssd is not supposed to be run without vendor
# clusterware, though, so this should not happen.
13)
$LOGMSG "Oracle CLSVMON did not find any vendor clusterware."
$TOUCH $NOCLSVMON
exit 0;
;;
# CLSVMON will return a status code of 14 if it thinks that another
# copy of clsvmon is alive. This will generally only happen if the
# user has come along and killed off a wrapper script and then duplicates
# got spawned. Here we shut down the other clsvmon, exit requesting a respawn,
# and start up again. If there is another copy of init.cssd clsvmon hanging
# around then it will also exit, but not get respawned. Our respawn will
# create a new copy of the daemon, and then be able to properly wait on it.
14)
$LOGMSG "Duplicate Oracle CLSVMON found. Killing and restarting it."
$EVAL $FINDCLSVMON | $AWK '{ print $2 ; }' | $XARGS $KILLDIE > $NULL 2>&1
$RMF $NOCLSVMON
exit 1;
;;
*)
$LOGMSG "Oracle CLSVMON terminated with unexpected status $RC."
$RMF $NOCLSVMON
exit 1;
;;
esac
;;
'oprocd')
# Runs the oprocd daemon. This script is supposed to exit 0
# if it decides that it should not be respawned, and exit 1 if it
# wants to be respawned. The purpose of oprocd is to detect system
# hangs, which often occur due to faulty drivers or hardware.
# On rare occasion this will get re-invoked while a shutdown is
# in progress. If so, this script should exit.
$ID/init.cssd runcheck
if [ "$?" != "0" ]; then
exit 0;
fi
# If we are in fatal mode, then let oprocd know right away.
if [ -f $FATALFILE ] && [ `$CAT $FATALFILE` = "enable" ] ; then
FATALARG="-f"
else
FATALARG=
fi
# Backup the oprocd logfiles
if [ -f $OPROCDLOG ] ; then
FILENAME=$OPROCDLOG.$UNIQUEDATE
$MVF $OPROCDLOG "$FILENAME"
fi
# Backup the oprocd last gasp files
if [ -f $OPROCDLGL ] ; then
FILENAME=$OPROCDLGL.$UNIQUEDATE
$MVF $OPROCDLGL "$FILENAME"
fi
# Run oprocd synchronously and look for its status code
cd $OPROCDIR
# startup the some diagnostic collection scripts if any
StartDiagCollect;
$OPROCD run -t $OPROCD_DEFAULT_TIMEOUT -m $OPROCD_DEFAULT_MARGIN \
$OPROCD_DEFAULT_HISTOGRAM $FATALARG
RC=$?
# shutdown diagnostic collection
StopDiagCollect;
# Oprocd will return a status code of 0 if a graceful shutdown has been
# requested. In this case, we do not want to be respawned.
if [ "$RC" = "0" ]; then
$LOGMSG "Oprocd received graceful shutdown request. Shutting down."
$TOUCH $NOOPROCD
exit 0;
fi
# Oprocd will return a status code of 1 if it notices that it is a
# duplicate copy of the daemon. This will generally only happen if the
# user has come along and killed off a wrapper script and then duplicates
# got spawned. Here we shut down the other oprocd, exit requesting a respawn,
# and start up again. If there is another copy of init.cssd oprocd hanging
# around then it will also exit, but not get respawned. Our respawn will
# create a new copy of the daemon, and then be able to properly wait on it.
if [ "$RC" = "1" ]; then
PROCDDUP=`$EVAL $FINDPROCD`
if [ ! -z "$PROCDDUP" ]; then
$OPROCD stop -t $OPROCD_STOP_TIMEOUT 2>$NULL
$LOGMSG "Duplicate spawn of Oprocd. See init.cssd for description."
else
$LOGMSG "WARNING: Oprocd exited unexpectedly. Check oprocd binary/log and restart the stack"
fi
$RMF $NOOPROCD
exit 1;
fi
# Oprocd will return a status code of 2 if it has noticed a system hang
# while in nonfatal mode. In this case we need to respawn it, so that if
# CSS starts allowing database IO that we have fencing guarantees.
if [ "$RC" = "2" ]; then
$LOGMSG "Oprocd detected system hang while in nonfatal mode. Respawning."
$RMF $NOOPROCD
exit 1;
fi
# If it is not one of the above, then request a respawn. Delay a bit
# in case this is a recurring failure, to avoid spinning.
$LOGMSG "Oprocd terminated with unexpected status $RC. Respawning."
$RMF $NOOPROCD
exit 1;
;;
'diskmon')
# Runs the diskmon daemon. This script is supposed to exit 0
# if it decides that it should not be respawned, and exit 1 if it
# wants to be respawned. The purpose of diskmon is to issue SAGE
# fence requests
# On rare occasion this will get re-invoked while a shutdown is
# in progress. If so, this script should exit.
$ID/init.cssd runcheck
if [ "$?" != "0" ]; then
exit 0;
fi
# If a diskmon is up, we want to kill it so that the new execution will
# be the only one up
$EVAL $FINDDISKMON
RC=$?
if [ $RC -eq 0 ]; then
$LOGMSG "Killing diskmon from previous startup"
$EVAL $FINDDISKMON | $AWK '{ print $2 ; }' | $XARGS $KILLDIE > $NULL 2>&1
fi
# Tracing and force takeover of local endpt args by default
DISKMON_ARGS='-d -f'
# Run diskmon synchronously and look for its status code
$DISKMON $DISKMON_ARGS
RC=$?
# Diskmon will return a status code of 0 if a graceful shutdown has been
# requested. In this case, we do not want to be respawned.
if [ "$RC" = "0" ]; then
$LOGMSG "Diskmon shutdown gracefully."
$TOUCH $NODISKMON
else
$LOGMSG "Diskmon terminated with unexpected status $RC. Respawning."
$RMF $NODISKMON
fi
exit $RC;
;;
'stop')
$LOGMSG "Oracle CSSD being stopped"
# disable CSS startup until the next boot
$ID/init.cssd norun
# shutdown the OPROCD process if it is running
if [ ! -f $NOOPROCD ]; then
$OPROCD stop -t $OPROCD_STOP_TIMEOUT 2>$NULL
fi
# No steps are necessary for shutting down clsomon. It will go down
# automatically when CSS is shutdown.
# Shut down oclsvmon if it is up.
if [ ! -f $NOCLSVMON ]; then
$EVAL $FINDCLSVMON | $AWK '{ print $2 ; }' | $XARGS $KILLTERM > $NULL 2>&1
fi
# shutdown diskmon
if [ ! -f $NODISKMON ]; then
DISKMON_STOPARGS='-s'
$DISKMON $DISKMON_STOPARGS
fi
# Invalidate init.cssd fatal pidfiles.
$ECHO "stopped" > $CSSFBOOT
$TOUCH $NOOPROCD
$TOUCH $NOCLSVMON
$TOUCH $NOCLSOMON
$TOUCH $NODISKMON
# Remove SUBSYSFILE on Linux
if [ "$PLATFORM" = "Linux" ]; then
$RMF $SUBSYSFILE
fi
# Now tell it to shut down.
if [ -x "$CRSCTL" ]; then
$CRSCTL stop crs
fi
$ECHO "Shutdown has begun. The daemons should exit soon."
;;
'run')
# Foreground run, for single instance or single-node installs only.
# If this is used in a cluster install, RDBMS datafile corruption is
# likely.
# Run the startcheck to see whether we should continue
$ID/init.cssd startcheck
while [ "$?" != "0" ]; do
$SLEEP $RUNRECHECKTIME
$ID/init.cssd startcheck
done
cd $ORA_CRS_HOME/log/$HOST/cssd
# If there is an old corefile by such a collision prone name, then
# rename it to something safe.
if [ -f ./core ]; then
$MVF ./core "$UNIQUECORE"
fi
$ECHO $USING_DISKMON > $DISKMONUSED
$CHOWN $ORACLE_USER $DISKMONUSED
STARTUP_OK=1
if [ "$USING_DISKMON" = "false" ]; then
$TOUCH $NODISKMON
else
# Use diskmon
$RMF $NODISKMON
STARTUP_OK=0
# Set cluster GUID
if [ -x "$CRSCTL" ]; then
STARTUP_OK=1
$CRSCTL get css clusterguid > /dev/null 2>&1
RC=$?
if [ $RC -ne 0 ]; then
GUID=`$CRSCTL set css clusterguid -force`
RC=$?
# The cluster GUID is required for SAGE, so do not start if
# unable to set cluster GUID
if [ $RC -ne 0 ]; then
STARTUP_OK=0
$LOGERR "Unable to set cluster GUID, cannot start clusterware"
fi
fi
fi
fi
# If we are unable to start, exit here
if [ $STARTUP_OK -eq 0 ]; then
exit 1
fi
$TOUCH $NOOPROCD # Never use OPROCD in local-only
$TOUCH $NOCLSVMON
$ECHO "disable" > $FATALFILE # disable reboot
# Start the CSSD
$ID/init.cssd daemon &
# We need to loop here to restart diskmon if it fails
while $TRUE; do
# Poll every second to see which of our children has gone away.
$SLEEP 1
# Check to see whether shutdown has been invoked.
if [ ! -r "$RUNFILE" ]; then
$LOGMSG "Filesystem containing $RUNFILE vanished."
$LOGMSG "Unpredictable behavior from Oracle CRS may ensue."
$SLEEP 30
continue;
fi
RUNID=`$CAT $RUNFILE`
if [ "norun" = "$RUNID" ]; then
# Shutdown was clearly invoked. Go away cleanly.
$LOGMSG "Oracle CSS family monitor shutting down gracefully."
# Invalidate pidfiles.
$ECHO "stopped" > $CSSFBOOT
exit 0;
fi
# Did the diskmon script go away?
if [ ! -f $NODISKMON ]; then
$KILL -0 $DISKMONSCRIPTPID > $NULL 2>&1
if [ "$?" != "0" ]; then
$EVAL $KILLCHECK > $NULL 2>&1
KC=$?
$KILL -0 $DISKMONSCRIPTPID > $NULL 2>&1
RK=$?
if [ "$KC" = "0" -a "$RK" != "0" ]; then
$ID/init.cssd diskmon &
DISKMONSCRIPTPID=$!
$ECHO $DISKMONSCRIPTPID > $DISKMONPIDFILE
fi
fi
fi
done
;;
'fatal')
# This action is invoked to start the CSS daemon in cluster mode,
# and one or more of its accompanying daemons oprocd or clsvmon or clsomon
# This respawn wrapper is done in lieu of adding new entries to inittab.
# Check to see if we are supposed to run this boot.
$ID/init.cssd startcheck
while [ "$?" != "0" ]; do
$SLEEP $RUNRECHECKTIME
$ID/init.cssd startcheck
done
# See discussion in LocalFence
$EVAL $CLEANREBOOTLOCK
# Determine which co-daemons we should be using on this system.
$TOUCH $NOCLSVMON
$TOUCH $NOCLSOMON
$TOUCH $NOOPROCD
$TOUCH $NODISKMON
# exit if we failed to create the nooprocd flag file
if [ "$?" != "0" ]; then
$LOGMSG "Failed to create $NOOPROCD. Exiting..."
exit 1;
fi
# if init.cssd fatal is respawning, then read in the children
# to monitor.
CSSFID=`$CAT $CSSFBOOT`
BOOTID=`$ID/init.cssd bootid`
if [ "$CSSFID" = "$BOOTID" ]; then
OPROCDSCRIPTPID=`$CAT $OPROCDPIDFILE`
CLSOMONSCRIPTPID=`$CAT $CLSOMONPIDFILE`
CLSVMONSCRIPTPID=`$CAT $CLSVMONPIDFILE`
DAEMONSCRIPTPID=`$CAT $DAEMONPIDFILE`
$LOGMSG "Oracle CSS Family monitor restarting."
else
$LOGMSG "Oracle CSS Family monitor starting."
fi
$ECHO "$BOOTID" > $CSSFBOOT
# Set some default pids so that the main loop will
# spawn the daemons on the first pass through.
if [ -z "$OPROCDSCRIPTPID" ]; then
OPROCDSCRIPTPID=nopid
fi
if [ -z "$DAEMONSCRIPTPID" ]; then
DAEMONSCRIPTPID=nopid
fi
if [ -z "$CLSVMONSCRIPTPID" ]; then
CLSVMONSCRIPTPID=nopid
fi
if [ -z "$CLSOMONSCRIPTPID" ]; then
CLSOMONSCRIPTPID=nopid
fi
# Only setup environment for OPROCD if
# 1) it is Not DISABLED for this platform
# 2) the daemon is installed
# 3) and vendor clusterware is not provided
if [ "$DISABLE_OPROCD" = "false" ] && [ -x "$OPROCD" ] &&
[ ! -f "$SKGXNLIB" ];
then
$RMF $NOOPROCD
fi
# Only use clsvmon if vendor clusterware is present.
if [ $USING_VC -eq 1 ]; then
$RMF $NOCLSVMON
fi
# Always use clsomon.
$RMF $NOCLSOMON
# Use diskmon if configured
$ECHO $USING_DISKMON > $DISKMONUSED
$CHOWN $ORACLE_USER $DISKMONUSED
STARTUP_OK=1
if [ "$USING_DISKMON" = "false" ]; then
$TOUCH $NODISKMON
else
# Use diskmon
$RMF $NODISKMON
fi
while $TRUE; do
# Poll every second to see which of our children has gone away.
$SLEEP 1
# Check to see whether shutdown has been invoked.
if [ ! -r "$RUNFILE" ]; then
$LOGMSG "Filesystem containing $RUNFILE vanished."
$LOGMSG "Unpredictable behavior from Oracle CRS may ensue."
$SLEEP 30
continue;
fi
RUNID=`$CAT $RUNFILE`
if [ "norun" = "$RUNID" ]; then
# Shutdown was clearly invoked. Go away cleanly.
$LOGMSG "Oracle CSS family monitor shutting down gracefully."
# Invalidate pidfiles.
$ECHO "stopped" > $CSSFBOOT
exit 0;
fi
# Did the oprocd script go away?
if [ ! -f $NOOPROCD ]; then
$KILL -0 $OPROCDSCRIPTPID > $NULL 2>&1
if [ "$?" != "0" ]; then
$EVAL $KILLCHECK > $NULL 2>&1
KC=$?
$KILL -0 $OPROCDSCRIPTPID > $NULL 2>&1
RK=$?
if [ "$KC" = "0" -a "$RK" != "0" ]; then
$ID/init.cssd oprocd &
OPROCDSCRIPTPID=$!
$ECHO $OPROCDSCRIPTPID > $OPROCDPIDFILE
fi
fi
fi
# Did the clsvmon script go away?
if [ ! -f $NOCLSVMON ]; then
$KILL -0 $CLSVMONSCRIPTPID > $NULL 2>&1
if [ "$?" != "0" ]; then
$EVAL $KILLCHECK > $NULL 2>&1
KC=$?
$KILL -0 $CLSVMONSCRIPTPID > $NULL 2>&1
RK=$?
if [ "$KC" = "0" -a "$RK" != "0" ]; then
$ID/init.cssd oclsvmon &
CLSVMONSCRIPTPID=$!
$ECHO $CLSVMONSCRIPTPID > $CLSVMONPIDFILE
fi
fi
fi
# Did the clsomon script go away?
if [ ! -f $NOCLSOMON ]; then
$KILL -0 $CLSOMONSCRIPTPID > $NULL 2>&1
if [ "$?" != "0" ]; then
$EVAL $KILLCHECK > $NULL 2>&1
KC=$?
$KILL -0 $CLSOMONSCRIPTPID > $NULL 2>&1
RK=$?
if [ "$KC" = "0" -a "$RK" != "0" ]; then
$ID/init.cssd oclsomon &
CLSOMONSCRIPTPID=$!
$ECHO $CLSOMONSCRIPTPID > $CLSOMONPIDFILE
fi
fi
fi
# Did the diskmon script go away?
if [ ! -f $NODISKMON ]; then
$KILL -0 $DISKMONSCRIPTPID > $NULL 2>&1
if [ "$?" != "0" ]; then
$EVAL $KILLCHECK > $NULL 2>&1
KC=$?
$KILL -0 $DISKMONSCRIPTPID > $NULL 2>&1
RK=$?
if [ "$KC" = "0" -a "$RK" != "0" ]; then
$ID/init.cssd diskmon &
DISKMONSCRIPTPID=$!
$ECHO $DISKMONSCRIPTPID > $DISKMONPIDFILE
fi
fi
fi
# Did the daemon script go away? Respawning here is not
# an intention to restart CSS. It allows the system of scripts
# to distinguish between several failure and shutdown scenarios.
$KILL -0 $DAEMONSCRIPTPID > $NULL 2>&1
if [ "$?" != "0" ]; then
$EVAL $KILLCHECK > $NULL 2>&1
KC=$?
$KILL -0 $DAEMONSCRIPTPID > $NULL 2>&1
RK=$?
if [ "$KC" = "0" -a "$RK" != "0" ]; then
$LOGMSG "Oracle CSS restart. $KC, $RK"
$ID/init.cssd daemon &
DAEMONSCRIPTPID=$!
$ECHO $DAEMONSCRIPTPID > $DAEMONPIDFILE
fi
fi
done
# We will never reach this
exit 0;
;;
'daemon')
# Run the CSS daemon in cluster mode. This will enable the fencing
# functionality not required in single-node mode. The CSS daemon
# monitors node health, and provides endpoint discovery for RDBMS.
# On rare occasion this will get re-invoked while a shutdown is
# in progress. If so, this script should exit.
$ID/init.cssd runcheck
if [ "$?" != "0" ]; then
exit 0;
fi
# Check to see if CSS is already up. If so, this indicates that
# someone has killed the "init.cssd daemon" script that was parenting
# that CSS daemon. This is a bad thing since we can't reattach a
# new parent to the CSS daemon.
CSSDUP=`$EVAL $FINDCSSD`
if [ ! -z "$CSSDUP" ]; then
$LOGMSG "Oracle CSSD shell script failure. Duplicate CSSD."
$EVAL $SLOW_REBOOT
$SLEEP 300
exit 0;
fi
# If we can set ourselves into realtime, do so, otherwise renice
# ourselves, and the child scripts. This is useful to ensure
# that we can perform the fence action if CSS kills itself due to
# unreasonable load. This script will remain asleep most of the time
# so a high priority shouldn't bother anything.
if [ "$REALTIME_PID" != "" ]; then
case $PLATFORM in
HP-UX)
$REALTIME_PID -$$
;;
*)
$REALTIME_PID $$
;;
esac
else
$RENICE -5 $$
fi
# Wait for oprocd to come up.
if [ ! -f $NOOPROCD ]; then
$OPROCD check -t $OPROCD_CHECK_TIMEOUT > $NULL 2>&1
RC=$?
while [ "$RC" != "0" ] && [ "$RC" != "1" ]; do
$LOGMSG "Oracle CSSD waiting for OPROCD to start"
$SLEEP 5
$OPROCD check -t $OPROCD_CHECK_TIMEOUT > $NULL 2>&1
RC=$?
done
fi
cd $ORA_CRS_HOME/log/$HOST/cssd
# If there is an old corefile by such a collision prone name, then
# rename it to something safe.
if [ -f ./core ]; then
$MVF ./core "$UNIQUECORE"
fi
# Arguments. By default none.
OCSSD_ARGS=
# Invoke the CSS daemon. Since SU can lose a few important settings, it
# is necessary to perform them inside the subshell.
case $PLATFORM in
AIX)
OCSSDDIR=$ORA_CRS_HOME/log/$HOST/cssd
$SU $ORACLE_USER -c \
"/bin/sh -c '$ULIMIT_CORE; ulimit -n $MAXFILE; cd $OCSSDDIR; $ORA_CRS_HOME/bin/ocssd $OCSSD_ARGS || exit \$?'"
RC=$?
;;
*)
$ULIMIT_CORE
ulimit -n $MAXFILE
$ORA_CRS_HOME/bin/ocssd $OCSSD_ARGS
RC=$?
;;
esac
# Three ways of going down. Graceful, Failing to Initialize, and
# Steady-state Failure.
case "$RC" in
0)
$LOGMSG "Oracle CSSD graceful shutdown"
;;
100)
$LOGMSG "Oracle CSS daemon failed to start up. Check CRS logs for diagnostics."
;;
110)
$LOGMSG "Oracle CSS daemon failed in non-fatal mode"
;;
*)
# Catch all remaining un-graceful return codes and perform the reboot
# action here.
$LOGERR "Oracle CSSD failure $RC."
LocalFence;
esac
# Shut down OPROCD and OCLSVMON. This gets shut down earlier if the
# user ran init.crs stop, but if they are using crsctl this was skipped.
if [ ! -f $NOOPROCD ]; then
$OPROCD stop 2>$NULL
fi
if [ ! -f $NOCLSVMON ]; then
$EVAL $FINDCLSVMON | $AWK '{ print $2 ; }' | $XARGS $KILLTERM > $NULL 2>&1
fi
# shutdown diskmon
if [ ! -f $NODISKMON ]; then
DISKMON_STOPARGS='-s'
$DISKMON $DISKMON_STOPARGS
fi
# Disable the CSS daemon from getting restarted until the next
# user intiated startup, or the next reboot cycle.
$ID/init.cssd norun
exit 0;
;;
'activatevg')
# Do nothing for now
exit 0;
;;
'start_msg')
# start message if we are being invoked as an RC script (only on HP-UX)
$ECHO "Start Oracle Cluster Synchronization Service"
;;
'stop_msg')
# stop message if we are being invoked as an RC script (only on HP-UX)
$ECHO "Stop Oracle Cluster Synchronization Service"
;;
*)
$ECHO "See documentation at the top of $0 about supported commands."
exit 1;
;;
esac
Back to top
Display of init.evmd File
Information Taken from /etc/init.d/init.evmd
#!/bin/sh
#
# init.evmd - Control script for the Oracle EVM daemon.
#
# This should not be in an rcX.d directory; it should only
# be invoked from init.crs.
#
# No manual invocation of init.evmd is supported.
#
ORA_CRS_HOME=/u01/crs/11.1.0/db_1
ORACLE_USER=oracle
ORACLE_HOME=$ORA_CRS_HOME
export ORACLE_HOME
export ORA_CRS_HOME
CAT=/bin/cat
RMF="/bin/rm -f"
LOGMSG="/bin/logger -puser.err"
ECHO=/bin/echo
KILL=/bin/kill
SU=/bin/su
GREP=/bin/grep
SLEEP=/bin/sleep
MVF="/bin/mv -f"
UNAME=/bin/uname
PLATFORM=`$UNAME`
# Incase /bin/hostname is not present in a particular platform, we
# may have to do something different.
HOSTN=/bin/hostname
EXPRN=/usr/bin/expr
CUT=/usr/bin/cut
AWK=/bin/awk
TR=/bin/tr
#solaris on amd and SPARC has issue with /bin/tr
[ 'SunOS' = `/bin/uname` ] && TR=/usr/xpg4/bin/tr
#on linux tr is at /usr/bin/tr
[ 'Linux' = `/bin/uname` ] && TR=/usr/bin/tr
#If the hostname is an IP address, let hostname
#remain as IP address
HOST=`$HOSTN`
len1=`$EXPRN "$HOST" : '.*'`
len2=`$EXPRN match $HOST '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*'`
# Strip off domain name in case /bin/hostname returns
# FQDN hostname
if [ $len1 != $len2 ]; then
HOST=`$ECHO $HOST | $CUT -d'.' -f1 `
fi
HOST=`$ECHO $HOST | $TR '[:upper:]' '[:lower:]'`
UNIQUEDATE=`/bin/date '+%Y-%m-%d-%H:%M:%S'`
UNIQUECORE=core.$UNIQUEDATE
#set ulimit to unlimited
ULIMIT_CORE="ulimit -c unlimited"
case $PLATFORM in
Linux)
ID=/etc/init.d
LOGGER="/usr/bin/logger"
if [ ! -f "$LOGGER" ];then
LOGGER="/bin/logger"
fi
LOGMSG="$LOGGER -puser.err"
SU="/bin/su -l"
;;
HP-UX)
ID=/sbin/init.d
;;
SunOS)
ID=/etc/init.d
;;
AIX)
ID=/etc
;;
OSF1)
ID=/sbin/init.d
;;
*) /bin/echo "ERROR: Unknown Operating System"
exit -1
;;
esac
# This file contains the PID of the running EVMD
PIDFILE=$ORA_CRS_HOME/evm/init/$HOST.pid
# Flags for communicating with evmd
FLAGFILE=$ORA_CRS_HOME/evm/init/$HOST.flags
case $1 in
'home')
$ECHO $ORA_CRS_HOME
exit 0;
;;
'user')
$ECHO $ORACLE_USER
exit 0;
;;
'stop')
$LOGMSG "Oracle EVMD set to stop"
;;
'run') # foreground run out of init
# Check to see if we are supposed to run this boot.
$ID/init.cssd startcheck
while [ "$?" != "0" ]; do
# recheck every once in a while, in case manual startup is invoked
$SLEEP 30
$ID/init.cssd startcheck
done
# Save the initial bootid.
BOOTID=`$ID/init.cssd bootid`
$RMF $FLAGFILE $PIDFILE
cd $ORA_CRS_HOME/log/$HOST/evmd
# If there is an old corefile by such a collision prone name, then
# rename it to something safe.
if [ -f ./core ]; then
$MVF ./core "$UNIQUECORE"
fi
# NOTE: su will wipe your LD_LIBRARY_PATH, but keep most of the
# remainder of the environment. It is necessary to run the evmd
# wrapper script from here instead of the binary directly.
shift
$SU $ORACLE_USER -c "sh -c '$ULIMIT_CORE; cd $ORA_CRS_HOME/log/$HOST/evmd; exec $ORA_CRS_HOME/bin/evmd $*'"
# Perform a quick system sanity check.
NEWBOOTID=`$ID/init.cssd bootid`
if [ "$NEWBOOTID" != "$BOOTID" ]; then
$LOGMSG "Oracle EVMD respawn disabled due to change in bootid."
fi
# Ensure that the hostname has not changed. This could prevent respawn.
NEWHOST=`$HOSTN`
len1=`$EXPRN "$NEWHOST" : '.*'`
len2=`$EXPRN match $NEWHOST '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*'`
# Strip off domain name in case /bin/hostname returns
# FQDN hostname
if [ $len1 != $len2 ]; then
NEWHOST=`$ECHO $NEWHOST | $CUT -d'.' -f1 `
fi
NEWHOST=`$ECHO $NEWHOST | $TR '[:upper:]' '[:lower:]'`
if [ "$NEWHOST" != "$HOST" ]; then
$LOGMSG "Oracle EVMD respawn disabled. Unsupported change in hostname."
fi
;;
*)
$ECHO "Manual invocation of $0 is not supported."
;;
esac
Back to top
Display of ocr.loc File
Information Taken from /etc/oracle/ocr.loc
ocrconfig_loc=/dev/mpath/mpath0p1
local_only=FALSE
Back to top
Display of cssfatal File
Information Taken from /etc/oracle/scls_scr/rac02/oracle/cssfatal
enable
Back to top
Display of diskmonused File
Information Taken from /etc/oracle/scls_scr/rac02/oracle/diskmonused
true
Back to top
Display of clsomonpid File
Information Taken from /etc/oracle/scls_scr/rac02/root/clsomonpid
10435
Back to top
Display of crsdboot File
Information Taken from /etc/oracle/scls_scr/rac02/root/crsdboot
2011-05-0423:33:41.192999847+0000/proc
Back to top
Display of crsstart File
Information Taken from /etc/oracle/scls_scr/rac02/root/crsstart
enable
Back to top
Display of cssfboot File
Information Taken from /etc/oracle/scls_scr/rac02/root/cssfboot
2011-05-0423:33:41.192999847+0000/proc
Back to top
Display of cssrun File
Information Taken from /etc/oracle/scls_scr/rac02/root/cssrun
2011-05-0423:33:41.192999847+0000/proc
Back to top
Display of daemonpid File
Information Taken from /etc/oracle/scls_scr/rac02/root/daemonpid
10548
Back to top
Display of noclsvmon File
Information Taken from /etc/oracle/scls_scr/rac02/root/noclsvmon
Back to top
Display of oprocdpid File
Information Taken from /etc/oracle/scls_scr/rac02/root/oprocdpid
10443
Back to top