1="lrdne67mp" 2="[DBFSXD011"]-> cat crs_common.ksh ############################################################################## # CRS Common functions # ############################################################################## crs_inst_order() { echo echo "Function name.: crs_inst_order................." echo "Library file..: crs_common.ksh................." echo "Directory ....: /oracle/admin/scripts/crsdbfs.." echo echo "Shows the installation order for the CRS services..." echo echo "Create a service first for GoldenGate" echo " function - srvctl_add_svc" echo " add a resource in CRS for DBFS (crs_add_res_dbfs)......" echo " naming is dbfs_ gg instance name.." echo " start the DBFS resource............." echo " stop the DBFS resource.............." echo " status of the resource.............." echo " relocate the resource..............." echo " " } crs_res_add_dbfs() ############################################################################## # Add resource to CRS for DBFS ############################################################################## { # GoldenGate XAG Instance gg_inst=$1 # Database for dependencies dbnm=$2 # Project Directory projdir=$3 echo $gg_inst echo $dbnm echo $projscr echo $projdir/mount_dbfs_$gg_inst.bsh echo echo "Function name.: crs_res_add_dbfs..............." echo "Library file..: crs_common.ksh................." echo "Directory ....: /oracle/admin/scripts/crsdbfs.." echo echo "Creating a CRS resource for DBFS..............." echo ###################################################################### # Check to see if the .bsh script has been created ...." ###################################################################### if [ ! -f "$projscr/mount_dbfs_$gg_inst.bsh" ]; then echo echo "The mount script does not exist please create and re-run"; echo exit else echo echo "The mount script exists and proceeding with CRS resource create" echo fi ###################################################################### # Check to see if the .conf file has been created ...." ###################################################################### if [ ! -f "$projscr/mount-dbfs_$gg_inst.conf" ]; then echo echo "The mount conf file does not exist please create and re-run"; echo exit else echo "The mount conf file exists and proceeding with CRS resource create" fi echo echo "Adding CRS resource for DBFS dbfs_"$gg_inst echo "MAKE SURE THE mount_dbfs script is in place before executing this!!!!" echo $CRS_HOME/bin/crsctl add resource dbfs_${gg_inst} -type cluster_resource -attr "ACTION_S CRIPT=$projscr/mount_dbfs_${gg_inst}.bsh, CHECK_INTERVAL=30, RESTART_ATTEMPTS=10, START_ DEPENDENCIES='hard(ora.$dbnm.db)pullup(ora.$dbnm.db)',STOP_DEPENDENCIES='hard(ora.$dbnm. db)',SCRIPT_TIMEOUT=300" # /oracle_crs/product/12.1.0.2/crs_1/bin/crsctl add resource dbfs_${gg_inst} -type clust er_resource -attr "ACTION_SCRIPT=/oracle/admin/scripts/crsdbfs/wrap_mount_dbfs_${gg_inst }.bsh, CHECK_INTERVAL=30, RESTART_ATTEMPTS=10, START_DEPENDENCIES='hard(ora.$dbnm.db)pul lup(ora.$dbnm.db)',STOP_DEPENDENCIES='hard(ora.$dbnm.db)',SCRIPT_TIMEOUT=300" } crs_res_start() ################################################################## # for the $1 parm only the name after dbfs_ needs to be specified # Start the dbfs resource ################################################################## { dbfsmnt=$1 nodename=$2 clear echo echo "Function name.: crs_res_start.................." echo "Library file..: crs_common.ksh................." echo "Directory ....: /oracle/admin/scripts/crsdbfs.." echo echo "Starting CRS resource for DBFS mount "$dbfsmnt echo echo "Start DBFS resource...." echo # /oracle_crs/product/12.1.0.2/crs_1/bin/crsctl start resource dbfs_$dbfsmnt -n server67mp /oracle_crs/product/12.1.0.2/crs_1/bin/crsctl start resource dbfs_$dbfsmnt -n $nodename # /oracle_crs/product/12.1.0.2/crs_1/bin/crsctl status resource dbfs_ggtxd001 echo echo "Status of DBFS resource...." echo crs_res_stat $dbfsmnt echo echo "df -hs or /dbfs_ mountpoints ...." echo df -ha |grep dbfs_ } crs_res_stop() { dbfsmnt=$1 clear echo echo "Function name.: crs_add_stop..................." echo "Library file..: crs_common.ksh................." echo "Directory ....: /oracle/admin/scripts/crsdbfs.." echo echo "Stopping CRS resource for DBFS................." echo echo "Stop DBFS resource...." echo /oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stop resource dbfs_$dbfsmnt echo echo "Status of DBFS resource...." echo crs_res_stat $dbfsmnt echo echo "df -hs or /dbfs_ mountpoints ...." echo df -ha |grep dbfs_ } crs_res_stat() ######################################### # Resource status ######################################### { gg_inst=$1 ### RVK Change Jan 14th 2019 >>> ### Replaced CRS_HOME hardcode path with $CRS_HOME (Note: CRS_HOME in Dev VA is differen t ### RVK End <<< $CRS_HOME/bin/crsctl status resource dbfs_$gg_inst } crs_res_relo() ######################################### # Resource relocate ######################################### { gg_inst=$1 to_node=$2 /oracle_crs/product/12.1.0.2/crs_1/bin/crsctl relocate resource dbfs_$gg_inst -node $to_ node } crs_res_del() ######################################### # Delete DBFS resource ######################################### { gg_inst=$1 /oracle_crs/product/12.1.0.2/crs_1/bin/crsctl delete resource dbfs_$gg_inst } crs_stat() { ######################################################################################## ### # The difference on the crs_stat is the directory mismatch on the TX vs VA cluster pair # Directory needed for TX cluster is 12.1.0.2 ######################################################################################## ### ######################################################################################## ### # This should be in the ggini file in order to drive the correct directory for all stand ard # scripts ######################################################################################## ### bindir="12.1.0.2" echo echo "crsctl stat res -t...." echo /oracle_crs/product/$bindir/crs_1/bin/crsctl status resource -t echo echo "Show services from the resource list...." echo /oracle_crs/product/$bindir/crs_1/bin/crsctl status resource -t|grep -a1 .svc echo echo "If nothing shows here, there are no dbfs mounts ......" echo df -ha|grep dbfs } crs_stat_xag() { gg_inst=$1 dbnm=$2 echo echo "If XAG resource is not yet setup then this will not work....." echo echo "XAG Instance name is $gg_inst / crsctl stat res xag.$gg_inst.goldengate -p all par ameters ...." echo # /oracle_crs/product/$bindir/crs_1/bin/crsctl stat res xag.ggtxd001.goldengate -p /oracle_crs/product/$bindir/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p echo echo "Cluster resource cluster resource (dbfs) action script values...." echo /oracle_crs/product/$bindir/crs_1/bin/crsctl stat res -w "TYPE = cluster_resource" -p | grep ACTION_SCRIPT echo echo "Cluster resource (dbfs) ..." echo # /oracle_crs/product/$bindir/crs_1/bin/crsctl stat res ora.dbfsxd01.dbfs_ggtxd001.svc - p /oracle_crs/product/$bindir/crs_1/bin/crsctl stat res ora.$dbnm.dbfs_$gg_inst.svc -p } crs_stat_xag_det() { ######################################################################################## # Were setting bindir because there is a difference between location of the binaries # on TX cluster vs VA cluster ######################################################################################## bindir="12.1.0.2" gg_inst=$1 echo echo "XAG Instance name is $gg_inst / crsctl stat res xag.$gg_inst.goldengate -p specifi c parameters ...." echo /oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p |grep DATAGUARD_AUTOSTART /oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p |grep DB_SERVICES /oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p |grep START_DEP /oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p |grep STOP_DEP /oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p |grep HOSTING /oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p |grep FILESYST /oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p |grep GG_HOME /oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p |grep PLACEMENT /oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p |grep USE_LOCAL_SERVICES /oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p |grep RELOCATE } srvctl_add_svc() ####################################################### # This is critical for the overall operation ####################################################### { gg_inst=$1 dbnm=$2 pfd=$3 avl=$4 echo echo "Create a service for GoldenGate in the format of svc_$gg_inst..................... ..." echo "This service is then used for setup through XAG for keying when GoldenGate fails o ver" echo "SRVCTL add service for svc_$gg_inst when role is primary.......................... ..." echo "This adds a GoldenGate resource thru SRVCTL ...................................... ..." echo "-preferred takes an instance name as parameter as does -available................. ..." echo echo "Showing before services database "$dbnm echo srvctl config service -db $dbnm|grep "Service " echo echo "Attempting to add service svc_"$gg_inst echo # Example on next line # srvctl add service -db $dbnm -service svc_$gg_inst -role PRIMARY -preferred DBFSXD011 -available DBFSXD012 srvctl add service -db $dbnm -service svc_$gg_inst -role PRIMARY -preferred $pfd -availa ble $avl echo echo "Showing after services database "$dbnm echo srvctl config service -db $dbnm|grep "Service " } srvctl_svc_mod() { dbnm=$1 svcnm=$2 pfd=$3 avl=$4 echo echo "This modifies the GG service created for XAG triggering " echo "the service name automatically has svc_ prepended to avoid misconfig for different service" echo srvctl modify service -db $dbnm -service svc_$svcnm -modifyconfig -preferred $pfd -avail able $avl -force } srvctl_sho_svc() { dbnm=$1 clear echo echo "Showing services database "$dbnm echo srvctl config service -db $dbnm|grep "Service " } crs_cr_mount_scrpt() { vsn="1.00" gginst=ggmrct001 flnm="mount_dbfs_mculp_test.bsh" echo echo "Create a mount script...." echo " Version "$vsn echo # cat here for create of file echo "....creating $flnm file......." cat << EOS > $flnm ### This script is from Note 1054431.1, ensure you have the latest version ### Note 1054431.1 provides information about the setup required to use this script ### MCulp modified 08/01/2018 ### The start section has been modified to work with BOA environment ############################################### # mount-dbfs.bsh start / stop / check / status ############################################### ############################################################### ### All configuration parameters are now in an external file ############################################################### ########################################### ### Ensure that when multiple mounts are used, there are separate copies ### of mount-dbfs.sh that reference separate CONFIG file pathnames # CONFIG=/etc/oracle/mount-dbfs.conf # MCulp change location #1 # This should have a conf file unique for each mount # The location is /oracle/admin/scripts for both the script # and the config file ############################################################## # CONFIG=/oracle/admin/scripts/crsdbfs/mount-dbfs_ggtxp002.conf CONFIG=/oracle/admin/scripts/crsdbfs/mount-dbfs_ggtxp003.conf ########################################### ### No editing is required below this point ########################################### ### date-based versioning YYYYMMDD VERSION=20160215 ### source configuration file if [ -r $CONFIG ]; then . $CONFIG else echo "$0 ERROR: cannot read config file $CONFIG, aborting" exit 1 fi ### the DBNAME should be set to the CDB name (from config file) CDB=$DBNAME ### determine platform UNAME_S=`uname -s` if [ $UNAME_S = 'Linux' ]; then LINUX=1; SOLARIS=0; elif [ $UNAME_S = 'SunOS' ]; then LINUX=0; SOLARIS=1; fi GREP=/bin/grep AWK=/bin/awk SED=/bin/sed ECHO=/bin/echo LOGGER="/bin/logger -t DBFS_${MOUNT_POINT}" RMF='/bin/rm -f' TOUCH=/bin/touch CHMOD=/bin/chmod PS=/bin/ps SLEEP=/bin/sleep KILL=/bin/kill BASENAME=/bin/basename STAT=/usr/bin/stat ID=/usr/bin/id WC=/usr/bin/wc SRVCTL=$ORACLE_HOME/bin/srvctl DBFS_CLIENT=$ORACLE_HOME/bin/dbfs_client HN=/bin/hostname PERL=/usr/bin/perl MOUNT=/bin/mount ### ensure messages are displayed in English for pattern matching LANG=en_US.UTF-8 NLS_LANG=American_America.AL32UTF8 NUMACTL=/usr/bin/numactl RPMCTL=/bin/rpm if [ -z "$STATUS_TIMEOUT" ]; then STATUS_TIMEOUT=0; fi if [ $LINUX -eq 1 ]; then MOUNT=/bin/mount XARGS='/usr/bin/xargs -r' FUSERMOUNT=/bin/fusermount LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib64 elif [ $SOLARIS -eq 1 ]; then MOUNT=/sbin/mount XARGS=/usr/bin/xargs UMOUNT=/usr/sbin/umount LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/rdbms/lib:/usr/lib:/lib fi DBFS_PWDFILE=$DBFS_PWDFILE_BASE.$$ export ORACLE_HOME LD_LIBRARY_PATH TNS_ADMIN export STAT MOUNT_POINT PERL_ALARM_TIMEOUT SOLARIS LINUX export PATH=$ORACLE_HOME/bin:$PATH export STATUS_TIMEOUT export LANG NLS_LANG logit () { ### type: info, error, debug type=$1 msg=$2 if [ "$type" = "info" ]; then $ECHO $msg $LOGGER -p ${LOGGER_FACILITY}.info "$msg" elif [ "$type" = "error" ]; then $ECHO $msg $LOGGER -p ${LOGGER_FACILITY}.error "$msg" elif [ "$type" = "debug" ]; then $ECHO $msg $LOGGER -p ${LOGGER_FACILITY}.debug "$msg" fi } ### must not be root if [ `$ID -u` -eq 0 ]; then logit error "Run this as the Oracle software owner, not root" exit 1 fi ### determine how we were called, derive location SCRIPTPATH=$0 SCRIPTNAME=`$BASENAME $SCRIPTPATH` $ECHO $SCRIPTPATH | $GREP ^/ > /dev/null 2>&1 if [ $? -ne 0 ]; then MYDIR=`pwd` SCRIPTPATH=${MYDIR}/${SCRIPTPATH} fi ### must cd to a directory where the oracle owner can get CWD cd /tmp case "$1" in ########################################## # Start begins here ########################################## 'start') echo "Start...." echo logit info "$SCRIPTNAME mounting DBFS at $MOUNT_POINT from database $DBNAME" ### check to see if it is already mounted $SCRIPTPATH status > /dev/null 2>&1 if [ $? -eq 0 ]; then logit error "$MOUNT_POINT already mounted, use $SCRIPTNAME stop before attempting to start" $SCRIPTPATH status exit 1 fi ### set the ORACLE_SID dynamically based on OCR info, if it is running # if RAC, set SID with following command export ORACLE_SID=$($SRVCTL status instance -d $DBNAME -n `$HN` | \ $GREP 'is running' | $AWK '{print $2}' ) # if single instance, set ORACLE_SID based on below command instead if [ -z "$ORACLE_SID" ]; then export ORACLE_SID=$($SRVCTL config db -d $DBNAME | $GREP 'instance' | $AWK '{print $ 3}') fi logit info "ORACLE_SID is $ORACLE_SID" ### further checks required if we are using a PDB ### if the local instance isn't running (because ORACLE_SID is null) don't bother if [ -n "$ORACLE_SID" -a "$IS_PDB" = 'true' ]; then logit info "IS_PDB = true" HOSTNAME=`$HN -s` ### by checking to see if the service is running on the local instance, ### we can deterine whether we should continue or not PDB_SERVICE_STATE=$($SRVCTL status service -d $CDB -s $PDB_SERVICE | \ $GREP "$ORACLE_SID" ) ### if the output from the last command is > 0, service is running locally if [ -n "$PDB_SERVICE_STATE" ]; then logit info "PDB service is online" else logit error "PDB service is offline. Exiting" exit 2 fi fi ### if there's no SID defined locally or it isn't running, stop if [ -z "$ORACLE_SID" -a "$WALLET" = 'false' ]; then logit error "No running ORACLE_SID available on this host, exiting" exit 2 fi ### version comparison function, used in numa section # Compare string versions # Returns in stdout and in the err code # 0 - a equal b # 1 - a greater than b # 255(-1) - a less than b # version should be in format 1.2.3.4.5 # It might be a short version like 1.2.3 or 1.2.3. version_cmp () { local -a al=(`$ECHO $1 | $SED -e 's/\./ /g'`) local -a bl=(`$ECHO $2 | $SED -e 's/\./ /g'`) local -i i=0 for ((i=0; i < ${#al[@]}; i++)); do # ap is always non-empty. Gap is not possible in both arrays local ap=${al[$i]} local bp=${bl[$i]} # Only $ap defined. $a longer (bigger) then $b if [ -z "$bp" ] || [ $ap -gt $bp ]; then $ECHO "1" return 1 elif [ $ap -lt $bp ]; then $ECHO "-1" return -1 fi done # Check for the next part from @bl. It means $a shorter (smaller) then $b if [ -n "${bl[$i]}" ]; then $ECHO "-1" return -1 fi # Both arrays ended at the same time. They are equal $ECHO "0" return 0 } # MCulp commenting out the whole section as we do not need this currently ######################################################################################## ### # ### if numa system on Linux, update mount_options for bug 10004611 # if [ $LINUX -eq 1 ]; then # RPMEXA=`$RPMCTL -q --queryformat '%{VERSION}' exadata-base` # NUMASYS=`$NUMACTL --hardware | $GREP available: | cut -c1-18` # # ###Check if an X8 system and image greater than or equal to 11.2.3.3.0 to support n uma mount option # if [ "$NUMASYS" = 'available: 8 nodes' ]; then # if [ `version_cmp $RPMEXA 11.2.3.3.0` -eq 0 ] || [ `version_cmp $RPMEXA 11.2.3.3. 0` -eq 1 ]; then # # MOUNT_OPTIONS=$MOUNT_OPTIONS,numa # MOUNT_OPTIONS=$MOUNT_OPTIONS # else # MOUNT_OPTIONS=$MOUNT_OPTIONS # fi # # ###Check if an X5-2 system to support numa mount option # elif [ "$NUMASYS" = 'available: 2 nodes' ]; then # # MOUNT_OPTIONS=$MOUNT_OPTIONS,numa # MOUNT_OPTIONS=$MOUNT_OPTIONS # ###Check for all other X2 systems, do not use numa option # elif [ "$NUMASYS" = 'available: 1 nodes' ]; then # MOUNT_OPTIONS=$MOUNT_OPTIONS # ###Exit for errors or unexpected values, post in messages file # else # logit error "Unexpected numa value. Exiting." # logit error "Numa hardware value is: $NUMASYS" # logit error "RPM version of Exadata base is: $RPMEXA" # exit 1 # fi # else # logit info "skipped numa check for Solaris...not applicable" # fi ######################################################################################## ### ### if using password-based startup, use this if [ "$WALLET" = 'false' -a -n "$DBFS_PASSWD" ]; then $RMF $DBFS_PWDFILE if [ -f $DBFS_PWDFILE ]; then logit error "please remove $DBFS_PWDFILE and try again" exit 1 fi $TOUCH $DBFS_PWDFILE $CHMOD 600 $DBFS_PWDFILE $ECHO $DBFS_PASSWD > $DBFS_PWDFILE logit info "spawning dbfs_client command using SID $ORACLE_SID" ### if PDB, mount with this command if [ "$IS_PDB" = 'true' ]; then (nohup $DBFS_CLIENT ${DBFS_USER}@${PDB} -o $MOUNT_OPTIONS \ $MOUNT_POINT < $DBFS_PWDFILE | $LOGGER -p ${LOGGER_FACILITY}.info 2>&1 & ) & ### if not PDB, mount with this command instead else echo "Correct command...." ### MCulp changed # nohup $ORACLE_HOME/bin/dbfs_client ggtxp003/not4good@dbfs_ggtxp003 -o rw,direct_io /dbfs_ggtxp003 < /oracle/admin/scripts/clle_dbfscommon/.gg_password &>/oracle/admin/scr ipts/crsdbfs/nohup.out # nohup $ORACLE_HOME/bin/dbfs_client ggtxp003/not4good@dbfs_ggtxp003 -o rw,direct_io /dbfs_ggtxp003 < /oracle/admin/scripts/clle_dbfscommon/.gg_password & nohup $ORACLE_HOME/bin/dbfs_client ggtxp002/not4good@dbfs_ggtxp003 -o $MOUNT_OPTIO NS /dbfs_ggtxp003 < /oracle/admin/scripts/clle_dbfscommon/.gg_password & # MOUNT_OPTIONS=rw,direct_io # This is the original mount command unmodified # MAKE SURE TO MODIFY THE entry after the @ symbol # The next line is the original line # (nohup $DBFS_CLIENT ${DBFS_USER}@ -o $MOUNT_OPTIONS \ # $MOUNT_POINT < $DBFS_PWDFILE | $LOGGER -p ${LOGGER_FACILITY}.info 2>&1 & ) & # MOUNT_TNS as added to the conf file that is read in ######################################################################################## echo echo $DBFS_USER echo echo $MOUNT_TNS echo echo $MOUNT_OPTIONS echo echo # (nohup $DBFS_CLIENT ${DBFS_USER}@$MOUNT_TNS -o $MOUNT_OPTIONS \ # $MOUNT_POINT < $DBFS_PWDFILE | $LOGGER -p ${LOGGER_FACILITY}.info 2>&1 & ) & fi ### if wallet is true, mount with this command elif [ "$WALLET" = true ]; then logit info "doing mount $MOUNT_POINT using SID $ORACLE_SID with wallet now" (nohup $DBFS_CLIENT /@${DBFS_LOCAL_TNSALIAS} -o $MOUNT_OPTIONS,wallet \ $MOUNT_POINT | $LOGGER -p ${LOGGER_FACILITY}.info 2>&1 & ) & fi ### allow time for the mount table update before checking it $SLEEP 1 $RMF $DBFS_PWDFILE ### set return code based on success of mounting $SCRIPTPATH status > /dev/null 2>&1 if [ $? -eq 0 ]; then logit info "Start -- ONLINE" exit 0 else logit info "Start -- OFFLINE" exit 1 fi ;; ############################################################ # MCulp Changed # Added z to the fusermount options as the u by itself # was not working correctly ############################################################ 'stop') $SCRIPTPATH status > /dev/null if [ $? -eq 0 ]; then logit info "unmounting DBFS from $MOUNT_POINT" if [ $LINUX -eq 1 ]; then logit info "umounting the filesystem using '$FUSERMOUNT -uz $MOUNT_POINT'" # $FUSERMOUNT -u $MOUNT_POINT $FUSERMOUNT -uz $MOUNT_POINT elif [ $SOLARIS -eq 1 ]; then logit info "umounting the filesystem using '$UMOUNT $MOUNT_POINT'" $UMOUNT $MOUNT_POINT > /dev/null 2>&1 fi $SCRIPTPATH status > /dev/null if [ $? -eq 0 ]; then logit error "Stop - stopped, but still mounted, error" exit 1 else logit info "Stop - stopped, now not mounted" exit 0 fi else logit error "filesystem $MOUNT_POINT not currently mounted, no need to stop" fi ;; 'check'|'status') ### check to see if it is mounted ### fire off a short process in perl to do the check (need the alarm builtin) logit debug "Checking status now" $PERL <<'TOT' $timeout = $ENV{'PERL_ALARM_TIMEOUT'}; $SIG{ALRM} = sub { ### we have a problem and need to cleanup exit 3; die "timeout" ; }; alarm $timeout; eval { $STATUSOUT=`$ENV{'STAT'} -f -c "%T" $ENV{'MOUNT_POINT'} 2>&1 `; chomp($STATUSOUT); ### added fuseblk check for Linux 6 output if ( ( $ENV{'SOLARIS'} == 1 && $STATUSOUT eq 'uvfs' ) || ( $ENV{'LINUX'} == 1 && $STATUSOUT eq 'UNKNOWN (0x65735546)' ) || ( $ENV{'LINUX'} == 1 && $STATUSOUT eq 'fuseblk' ) ) { ### status is okay exit 0; } elsif ( $STATUSOUT =~ /Transport endpoint is not connected/ ) { ### we have a problem, need to clean up exit 2; } else { ### filesystem is offline exit 1; } }; TOT RC=$? ### process return codes from the perl block if [ $RC -eq 3 ]; then STATUS_TIMEOUT=$(( $STATUS_TIMEOUT + 1 )) logit error "Found timeout while checking status, cleaning mount automatically" $SCRIPTPATH clean logit debug "Check -- OFFLINE" exit 1 elif [ $RC -eq 2 ]; then STATUS_TIMEOUT=$(( $STATUS_TIMEOUT + 1 )) logit error "Found error while checking status, cleaning mount automatically" $SCRIPTPATH clean logit debug "Check -- OFFLINE" exit 1 elif [ $RC -eq 1 ]; then logit debug "Check -- OFFLINE" exit 1 elif [ $RC -eq 0 ]; then logit debug "Check -- ONLINE" exit 0 fi ;; 'restart') logit info "restarting DBFS" $SCRIPTPATH stop $SLEEP 2 $SCRIPTPATH start ;; ########################################################################## # clean abort # MCulp 08/01/2018 # Added z to the fusermount option below ########################################################################## 'clean'|'abort') logit info "cleaning up DBFS nicely using (fusermount -u|umount)" if [ $LINUX -eq 1 ]; then $FUSERMOUNT -u $MOUNT_POINT elif [ $SOLARIS -eq 1 ]; then $UMOUNT $MOUNT_POINT > /dev/null 2>&1 fi $SLEEP 1 FORCE_CLEANUP=0 if [ $STATUS_TIMEOUT -gt 1 ]; then FORCE_CLEANUP=1 else $SCRIPTPATH status > /dev/null if [ $? -eq 0 ]; then FORCE_CLEANUP=1; fi fi if [ $FORCE_CLEANUP -eq 1 ]; then logit error "tried (fusermount -u|umount), still mounted, now cleaning with (fuser mount -uz -z|umount -f) and kill" if [ $LINUX -eq 1 ]; then $FUSERMOUNT -u -z $MOUNT_POINT elif [ $SOLARIS -eq 1 ]; then $ECHO "running umount -f now" $UMOUNT -f $MOUNT_POINT > /dev/null 2>&1 fi if [ $LINUX -eq 1 ]; then PIDS=`$PS -ef | $GREP -w "$MOUNT_POINT" | $GREP dbfs_client| $GREP -v grep | \ $AWK '{print $2}'` if [ -n "$PIDS" ]; then $KILL -9 $PIDS; fi PIDS=`$PS -ef | $GREP -w "$MOUNT_POINT" | $GREP mount.dbfs | $GREP -v grep | \ $AWK '{print $2}'` if [ -n "$PIDS" ]; then $KILL -9 $PIDS; fi elif [ $SOLARIS -eq 1 ]; then PIDS=`$PS -ef | $GREP dbfs_client| $GREP -v grep | $AWK '{print $2}'` REALPIDS=' ' for pid in $PIDS do ARGS=`pargs $pid` $ECHO $ARGS | $GREP "$MOUNT_POINT$" > /dev/null RET=$? if [ $RET -eq 0 ]; then REALPIDS="$REALPIDS $pid"; fi done if [ -n "$REALPIDS" ]; then $KILL -9 $REALPIDS; fi ### do it a 2nd time to clean up others if [ -n "$REALPIDS" ]; then $KILL -9 $REALPIDS; fi PIDS=`$PS -ef | $GREP dbfs_client| $GREP -v grep | $AWK '{print $2}'` REALPIDS=' ' for pid in $PIDS do ARGS=`pargs $pid` $ECHO $ARGS | $GREP "$MOUNT_POINT$" > /dev/null RET=$? if [ $RET -eq 0 ]; then REALPIDS="$REALPIDS $pid"; fi done if [ -n "$REALPIDS" ]; then $KILL -9 $REALPIDS; fi fi exit 1 fi ;; 'version') ### simply show the version echo "$VERSION" ;; *) $ECHO "Usage: $SCRIPTNAME { start | stop | check | status | restart | clean | abort | version }" ;; esac EOS echo "$flnm has been created please review file and modify file....." ###### end of the file