#!/bin/ksh # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # 61haes_r714 src/43haes/usr/sbin/cluster/utilities/clchipat.sh 1.2.7.1 # # Licensed Materials - Property of IBM # # COPYRIGHT International Business Machines Corp. 1990,2011 # All Rights Reserved # # US Government Users Restricted Rights - Use, duplication or # disclosure restricted by GSA ADP Schedule Contract with IBM Corp. # # IBM_PROLOG_END_TAG # @(#)59 1.2.7.1 src/43haes/usr/sbin/cluster/utilities/clchipat.sh, hacmp.utils, 61haes_r714 11/28/11 14:53:10 ############################################################################### # # COMPONENT_NAME: UTILITIES # # FUNCTIONS: none # # Name: clchipat # # This routine configures/unconfigures IP Address Takeover # processing in /etc/inittab and /etc/rc.net # # If the argument is "true" IPAT is configured # If the argument is "false" IPAT configuration is removed # # If /usr/es/sbin/cluster/.use_telinit exists, the legacy telinit a mode is enabled. # The old copies of the files are saved as /etc/inittab.orig, # /etc/rc.net.orig, and /etc/rc.nfs.orig # # If IPAT is being configured, rc.net is modified to exit if not # passed the "-boot" argument from the rc.cluster. Furthermore # inittab entries pertaining to network startup are moved to run-level # "a" so that they won't be run until explicitly triggered from the # cluster software. # # Usage: cl_chipat "true|false" [-V] # # Arguments: # true - add entries to /etc/inittab /etc/rc.net # false - remove entries from /etc/inittab # # -V verbose, show all added, deleted or modified entries # # Returns: 0 - success (no changes required) # 1 - any system error # 2 - bad number (0) of arguments # Environment: # ############################################################################### ################################################################################ # Function: clutils_log # # This function writes a message to the log file used by clchipat # # Arguments: None # Returns : None # Environments: None # ################################################################################# clutils_log() { typeset PS4_FUNC="clutils_log" echo "$(date) $PROGNAME: $*" >> $CLUTILS_LOG_FILE } ################################################################################ # Function: err_filesystem_full # # This function produces error message(s) indicating that the /var or / filesystems # are potentially causing previous failure message(s) related to rc.net or inittab # creation scripts. # # Arguments: None # Returns : None # Environments: None # ################################################################################# err_filesystem_full () { typeset PS4_FUNC="err_filesystem_full" VARSIZE=`df /var | tail -n 1 | awk '{ print $4}' | sed 's/%//g'` ROOTSIZE=`df / | tail -n 1 | awk '{ print $4}' | sed 's/%//g'` dspmsg scripts.cat 9200 "A possible reason for the error shown above was due to the /var or / filesystem being completely or partially full.\\n\ /var is %s\% full and / is %s\% full.\\n\\n\ Please correct this problem by removing obsolete files in, or increasing the size of /var and /.\\n" $VARSIZE $ROOTSIZE } ############################################################################### # # Name: cleanup_rcnet # # This routine removes all HACMP related lines from /etc/rc.net # # Arguments: NONE # Returns: NONE # Environment: $TAG - string that marks High Availability Cluster # $RCNET_FILE - file to be modified # ############################################################################### cleanup_rcnet () { typeset PS4_FUNC="cleanup_rcnet" grep -q "# $TAG" $RCNET_FILE || return 0 clutils_log "cleanup_rcnet" RCNET_CHANGED="true" # clean up all HACMP-related lines ed - $RCNET_FILE <<- DONE g/# $TAG/d w q DONE return $? } ############################################################################### # # Name: setup_rcnet # # This routine adds High Availability Cluster Multi-Processing # for AIX specific processing to the top of the # /etc/rc.net file. This processing consists of an expression # that causes rc.net to exit if an argument of "-boot" is not # present on the command line. All lines are marked with a tag string # in a comment to facilitate automated stripping later # Arguments: NONE # Returns: NONE # Environment: $TAG - string that marks High Availability Cluster # $RCNET_FILE - file to be modified # ############################################################################### setup_rcnet () { typeset PS4_FUNC="setup_rcnet" # Check to see if the line already exists in the file /usr/bin/head -n 17 $RCNET_FILE | /usr/bin/tail -n 1 | /usr/bin/grep "ps -ef" >/dev/null 2>&1 if [[ $? -eq 0 ]] then return 0 fi (( USE_TELINIT )) || return 0 if [[ "$SHOW_CHANGED_VALUES" = "true" ]]; then echo "add:rc.net" fi clutils_log "add rc.net" NFS_ERR=$(ksh -n ${RCNET_FILE} 2>&1 ) if [[ -n $NFS_ERR ]] then dspmsg scripts.cat -s 24 10 "%s: ERROR: The following errors exist in %s.\n\n" $PROGNAME $RCNET_FILE ksh -n ${RCNET_FILE} dspmsg scripts.cat -s 24 29 "\n'ksh -n %s' must be clean before %s can be modified. Please fix the problems and run %s false and %s true\n" $RCNET_FILE $RCNET_FILE $PROGNAME $PROGNAME clutils_log "Pre-existing errors detected in $RCNET_FILE" echo $NFS_ERR >> $CLUTILS_LOG_FILE return 99 fi # add line to /etc/rc.net to exit if -boot not set ed - $RCNET_FILE > /dev/null <<- DONE 14a # $TAG # $TAG These lines added by $TAG software ps -ef | grep -w \"\/sbin\/rc\.boot\" # $TAG if [[ \$? != 0 ]] && [[ \$1 != -boot ]] # $TAG then # $TAG exit 0; # $TAG fi # $TAG # $TAG . /\/usr\/lib\/methods\/cfgif/ a /usr/lib/methods/cfgech -2 # $TAG AIX_CFGMGR_MODE=1 /usr/lib/methods/cfgif # $TAG /usr/es/sbin/cluster/events/utils/cl_configure_persistent_address config_all -d # $TAG . w q DONE rc=$? if (( ! rc )) then NFS_ERR=$(ksh -n ${RCNET_FILE} 2>&1 ) if [[ -n $NFS_ERR ]] then dspmsg scripts.cat -s 24 30 "%s: New errors would exist in %s. The new errors are:\n\n" $PROGNAME $RCNET_FILE echo $NFS_ERR dspmsg scripts.cat -s 24 40 "\nReverting to original %s. Consult IBM Service to resolve this issue.\n" $RCNET_FILE clutils_log "New errors detected in $RCNET_FILE - reverting to original" echo $NFS_ERR >> $CLUTILS_LOG_FILE cp $RCNET_TEMP $RCNET_FILE rc=99 fi fi return $rc } ############################################################################### # # Name: err_rcnet # # This routine displays an rc.net modification error message # ############################################################################### err_rcnet () { typeset PS4_FUNC="err_rcnet" dspmsg scripts.cat 242 "$PROGNAME: error modifying rc.net.\n\ Original file saved as $RCNET_TEMP\n" >&2 $PROGNAME $RCNET_TEMP clutils_log "error modifying rc.net, Original file saved as $RCNET_TEMP" err_filesystem_full } ############################################################################### # # Name: cleanup_rcnfs # # This routine cleans up all HACMP-related lines from /etc/rc.nfs # # Arguments: NONE # Returns: NONE # Environment: $TAG - string that marks HACMP-specific lines # $RCNFS_FILE - file to be modified # ############################################################################### cleanup_rcnfs () { typeset PS4_FUNC="err_rcnfs" typeset -i RC grep -q "# $TAG" $RCNFS_FILE || return 0 clutils_log "Remove the HACMP version of APAR IZ16211 from /etc/rc.nfs" RCNFS_CHANGED="true" # clean up all HACMP-related lines /usr/bin/grep -qx "# $TAG #.*>.*/etc/xtab" $RCNFS_FILE if [[ $? -eq 0 ]] then ed - $RCNFS_FILE <<- DONE /^# ${TAG}.*>.*\/etc\/xtab/s/^# $TAG #// g/# $TAG/d w q DONE RC=$? else ed - $RCNFS_FILE <<- DONE g/# $TAG/d w q DONE RC=$? fi return $RC } ############################################################################### # # Name: setup_rcnfs # # Defect 633625 (APAR IZ16211 for AIX 6.1 and APAR IZ16210 for AIX 5.3) # addresses the problem of /etc/rc.nfs truncating /etc/xtab. # # setup_rcnfs will detect the presence of the APAR. If it has not been applied, # then setup_rcnfs will apply the HACMP version of the fix. # # Arguments: NONE # Returns: NONE # Environment: $TAG - string that marks HACMP-specific lines # $RCNFS_FILE - file to be modified # ############################################################################### setup_rcnfs () { typeset PS4_FUNC="setup_rcnfs" # Check to see if APAR IZ16211 already exists in the file /usr/bin/grep -q "nfsd_running" $RCNFS_FILE if [[ $? -eq 0 ]] then if [[ "$SHOW_CHANGED_VALUES" = "true" ]]; then echo "APAR IZ16211 is already installed" fi clutils_log "APAR IZ16211 is already installed" return 0 fi if [[ "$SHOW_CHANGED_VALUES" = "true" ]]; then echo "add:rc.nfs" fi clutils_log "Add the PowerHA SystemMirror version of APAR IZ16211 to /etc/rc.nfs" RCNFS_CHANGED="true" NFS_ERR=$(ksh -n ${RCNFS_FILE} 2>&1 ) if [[ -n $NFS_ERR ]] then dspmsg scripts.cat -s 24 10 "%s: ERROR: The following errors exist in %s.\n\n" $PROGNAME $RCNFS_FILE ksh -n ${RCNFS_FILE} dspmsg scripts.cat -s 24 20 "\n'ksh -n %s' must be clean before %s can be modified. Please fix the problems and run %s false and %s true\n" $RCNFS_FILE $RCNFS_FILE $PROGNAME $PROGNAME clutils_log "Pre-existing errors detected in $RCNFS_FILE" echo $NFS_ERR >> $CLUTILS_LOG_FILE return 99 fi # Add APAR IZ16211 to /etc/rc.nfs # Since this is not the official APAR, tag it for removal ed - $RCNFS_FILE <<- DONE /^# If nfs daemon is executable and.*become nfs server/a # $TAG nfsd_running=0 # $TAG if ps -eo comm | grep -w nfsd > /dev/null ; then # $TAG nfsd_running=1 # $TAG fi # $TAG # $TAG mountd_running=0 # $TAG if ps -eo comm | grep -w rpc.mountd > /dev/null ; then # $TAG mountd_running=1 # $TAG fi # $TAG # $TAG # Truncate xtab only if the nfsd and mountd daemons are not active # $TAG if (( !nfsd_running && ! mountd_running )); then # $TAG /usr/sbin/exportfs -ua # $TAG fi # $TAG # $TAG # $TAG # $TAG - The xtab line below commented-out by $TAG software . w q DONE rc1=$? rc2=0 #Initially /usr/bin/grep -qx ".*>.*/etc/xtab" $RCNFS_FILE if [[ $? -eq 0 ]]; then ed - $RCNFS_FILE <<- DONE /^[^#]*>.*\/etc\/xtab/s/^/# $TAG #/ w q DONE rc2=$? fi rc=$((rc1 || rc2)) if (( ! rc )) then NFS_ERR=$(ksh -n ${RCNFS_FILE} 2>& 1) if [[ -n $NFS_ERR ]] then dspmsg scripts.cat -s 24 30 "%s: New errors would exist in %s. The new errors are:\n\n" $PROGNAME $RCNFS_FILE echo $NFS_ERR dspmsg scripts.cat -s 24 40 "\nReverting to original %s. Consult IBM Service to resolve this issue.\n" $RCNFS_FILE clutils_log "New errors detected in $RCNFS_FILE - reverting to original" echo $NFS_ERR >> $CLUTILS_LOG_FILE cp $RCNFS_TEMP $RCNFS_FILE rc=99 fi fi return $rc } ############################################################################### # # Name: err_rcnfs # # This routine displays an rc.nfs modification error message # ############################################################################### err_rcnfs () { typeset PS4_FUNC="err_ecnfs" # This needs a new NLS message catalog number dspmsg scripts.cat -s 24 50 "$PROGNAME: error modifying rc.nfs.\n\ Original file saved as $RCNFS_TEMP\n" >&2 $PROGNAME $RCNFS_TEMP err_filesystem_full } ############################################################################### # # Name: err_inittab # # This routine displays an inittab modification error message # ############################################################################### err_inittab () { typeset PS4_FUNC="err_inittab" dspmsg scripts.cat 241 "$PROGNAME: error modifying inittab.\n\ Original file saved as $INITTAB_TEMP\n" >&2 $PROGNAME $INITTAB_TEMP clutils_log "error modifying inittab. Original file saved as $INITTAB_TEMP\n" err_filesystem_full } ############################################################################### # MAIN starts here ############################################################################### [ "$VERBOSE_LOGGING" = "high" ] && set -x PROGNAME=$(basename ${0}) PATH="$($(dirname ${0})/cl_get_path all)" HA_DIR="$(cl_get_path)" TAG="HACMP for AIX" STATUS=0 # Setup the log file ODMDIR="/etc/${HA_DIR}/objrepos" DEFAULTLOGDIR="/var/hacmp/log" STANZA=$(odmget -q"name = clutils.log" HACMPlogs) if [ "$STANZA" != "" ] then DESTDIR=`echo $STANZA | cut -d'"' -f8` CLUTILS_LOG_FILE="$DESTDIR/clutils.log" else CLUTILS_LOG_FILE="$DEFAULTLOGDIR/clutils.log" fi clutils_log "$*" if [[ "$#" -gt 2 ]] then dspmsg scripts.cat 240 "usage: $PROGNAME {true|false}\n" $PROGNAME >&2 clutils_log "usage: $PROGNAME {true|false}" exit 2 fi ONOFF="$1" SHOW_CHANGED_VALUES="false" if [[ "$2" = "-V" ]]; then SHOW_CHANGED_VALUES="true" fi # Determine telinit mode (disabled is default) TELINIT_FILE="/usr/${HA_DIR}/sbin/cluster/.telinit" USE_TELINIT_FILE="/usr/${HA_DIR}/sbin/cluster/.use_telinit" if [[ ! -f $USE_TELINIT_FILE ]] then clutils_log "telinit a mode disabled" USE_TELINIT=0 else if [[ "$SHOW_CHANGED_VALUES" = "true" ]]; then echo "telinit a mode enabled" fi clutils_log "telinit a mode enabled" USE_TELINIT=1 fi # exit on program error or undefined variable set -u ################################################################################ # # Perform the inittab modifications # ################################################################################ HARC_NET_FILE="/usr/${HA_DIR}/sbin/cluster/etc/harc.net" INITTAB_FILE="/etc/inittab" INITTAB_TEMP="/tmp/inittab.$$" INITTAB_BACKUP="${INITTAB_FILE}.orig" TEMP_CLEAN="true" INITTAB_CHANGED="false" cp $INITTAB_FILE $INITTAB_TEMP if [ $? -ne 0 ] then dspmsg scripts.cat 550 "$PROGNAME: Unable to create backup copy of inittab.\n" $PROGNAME clutils_log "Unable to create backup copy of inittab" exit 1 fi trap err_inittab 1 2 3 # determine destination run-level if (( USE_TELINIT )) && [[ "$ONOFF" = "true" ]] then NEWRUNLEVEL="a" else NEWRUNLEVEL="2" fi trap err_inittab 1 2 3 # modify inittab so that network is not fully enabled until # High Availability Cluster Multi-Processing Version 4.1 for AIX is running move the specified inittab entries to # runlevel $NEWRUNLEVEL # for ident in rctcpip rcnfs writesrv qdaemon rcncs aicd do if cl_lsitab $ident >/dev/null 2>&1 then OIFS=$IFS IFS=$IFS: set $(cl_lsitab $ident) >/dev/null 2>&1 IFS=$OIFS LABEL=$1 shift 2 ACTION=$1 shift 1 COMMAND="$*" ITABENTRY=`cl_lsitab $ident` if [[ "$ITABENTRY" != "$LABEL:$NEWRUNLEVEL:$ACTION:$COMMAND" ]]; then INITTAB_CHANGED="true" if [[ "$SHOW_CHANGED_VALUES" = "true" ]]; then echo "modify:inittab:$LABEL:$NEWRUNLEVEL:$ACTION:$COMMAND" fi clutils_log "modify:inittab:$LABEL:$NEWRUNLEVEL:$ACTION:$COMMAND" cl_chitab $LABEL:$NEWRUNLEVEL:$ACTION:"$COMMAND" fi fi done if [[ "$ONOFF" == "true" ]] then if (( ! USE_TELINIT )) then # telinit a mode is disabled - Add harc.net after rc.tcpip cl_lsitab harc #>/dev/null 2>&1 if [[ $? -ne 0 ]] then if [[ "$SHOW_CHANGED_VALUES" = "true" ]]; then echo "add:inittab:harc:2:wait:${HARC_NET_FILE}" fi INITTAB_CHANGED="true" clutils_log "add:inittab:harc:2:wait:${HARC_NET_FILE}" cl_mkitab -i rctcpip "harc:2:wait:${HARC_NET_FILE} # $TAG network startup" fi else # telinit a mode is enabled - Add harc.net after srcmstr cl_lsitab harc #>/dev/null 2>&1 if [[ $? -ne 0 ]] then if [[ "$SHOW_CHANGED_VALUES" = "true" ]]; then echo "add:inittab:harc:2:wait:${HARC_NET_FILE}" fi INITTAB_CHANGED="true" clutils_log "add:inittab:harc:2:wait:${HARC_NET_FILE}" cl_mkitab -i srcmstr "harc:2:wait:${HARC_NET_FILE} # $TAG network startup" fi # telinit a mode is enabled - Add telinit a completion cl_lsitab clinit >/dev/null 2>&1 if [[ $? -ne 0 ]] then INITTAB_CHANGED="true" USRMSG="# ${TAG} These must be the last entries of run level "a" in inittab!" TELSTRING="/bin/touch ${TELINIT_FILE} ${USRMSG}" PSTSTRING="/bin/echo Created ${TELINIT_FILE} > /dev/console ${USRMSG}" if [[ "$SHOW_CHANGED_VALUES" = "true" ]]; then echo "add:inittab:pst_clinit:a:wait:${PSTSTRING}" echo "add:inittab:clinit:a:wait:${TELSTRING}" fi clutils_log "add:inittab:clinit:a:wait:${TELSTRING}" cl_mkitab "clinit:a:wait:${TELSTRING}" clutils_log "add:inittab:pst_clinit:a:wait:${TELSTRING}" cl_mkitab "pst_clinit:a:wait:${PSTSTRING}" fi fi fi if [[ "$ONOFF" == "false" ]] then cl_lsitab harc >/dev/null 2>&1 if [[ $? -eq 0 ]] then if [[ "$SHOW_CHANGED_VALUES" = "true" ]]; then echo "delete:inittab:harc" fi INITTAB_CHANGED="true" clutils_log "delete:inittab:harc" cl_rmitab harc >/dev/null 2>&1 fi fi if [[ "$ONOFF" == "false" ]] || (( ! USE_TELINIT )) then cl_lsitab clinit >/dev/null 2>&1 if [[ $? -eq 0 ]] then if [[ "$SHOW_CHANGED_VALUES" = "true" ]]; then echo "delete:inittab:clinit" fi INITTAB_CHANGED="true" clutils_log "delete:inittab:clinit" cl_rmitab clinit >/dev/null 2>&1 fi cl_lsitab pst_clinit >/dev/null 2>&1 if [[ $? -eq 0 ]] then if [[ "$SHOW_CHANGED_VALUES" = "true" ]]; then echo "delete:inittab:pst_clinit" fi INITTAB_CHANGED="true" clutils_log "delete:inittab:pst_clinit" cl_rmitab pst_clinit >/dev/null 2>&1 fi fi # flush buffer for /etc/inittab and rerun telinit. These are precautions for problems # experienced with the init command if [[ "$INITTAB_CHANGED" == "true" ]] then clutils_log "fsync and telinit q" syscall open $INITTAB_FILE 2 0 \; fsync \$0 \; close \$0 telinit q clutils_log "/etc/inittab changed" if cp $INITTAB_TEMP $INITTAB_BACKUP then rm -f $INITTAB_TEMP else dspmsg scripts.cat 243 "$PROGNAME: Unable to move old inittab $INITTAB_TEMP to $INITTAB_BACKUP\n"\ $PROGNAME $INITTAB_TEMP $INITTAB_BACKUP clutils_log "Unable to move old inittab $INITTAB_TEMP to $INITTAB_BACKUP" STATUS=1 TEMP_CLEAN="false" fi fi # We create a temporary file for inittab irrespective of whether # we have some thing to change or not. So this code makes sure # we remove the temporary file when no error occurs if [[ -f $INITTAB_TEMP ]] then if [[ $TEMP_CLEAN = "true" ]] then rm -f $INITTAB_TEMP fi fi ################################################################################ # # Perform /etc/rc.net modifications # ################################################################################ RCNET_FILE="/etc/rc.net" RCNET_TEMP="/tmp/rc.net.$$" RCNET_BACKUP="$RCNET_FILE.orig" RCNET_CHANGED="false" TEMP_CLEAN="true" cp $RCNET_FILE $RCNET_TEMP if [[ $? -ne 0 ]] then dspmsg scripts.cat 551 "$PROGNAME: Unable to create backup copy of rc.net.\n" $PROGNAME clutils_log "Unable to create backup copy of rc.net." exit 1 fi trap err_rcnet 1 2 3 # we always start by removing existing High Availability Cluster # Multi-Processing Version 4.1 for AIX stuff from rc.net # we'll add new stuff if called for cleanup_rcnet if [[ $? -ne 0 ]] then dspmsg scripts.cat 242 "$PROGNAME: error modifying rc.net.\n\ Original file saved as $RCNET_TEMP\n" $PROGNAME $RCNET_TEMP >&2 clutils_log "error modifying rc.net. Original file saved as $RCNET_TEMP" err_filesystem_full exit 1 fi if [[ "$ONOFF" = "true" ]] && (( USE_TELINIT )) then setup_rcnet rc=$? if [[ $rc -ne 0 ]] then if [[ "$rc" != "99" ]] then dspmsg scripts.cat 242 "$PROGNAME: error modifying rc.net.\n\ Original file saved as $RCNET_TEMP\n" $PROGNAME $RCNET_TEMP >&2 clutils_log "error modifying rc.net.Original file saved as $RCNET_TEMP" err_filesystem_full fi exit 1 fi fi # # flush buffer for /etc/rc.net # if [[ "$RCNET_CHANGED" == "true" ]] then clutils_log "rc.net changed" syscall open $RCNET_FILE 2 0 \; fsync \$0 \; close \$0 if cp $RCNET_TEMP $RCNET_BACKUP then rm -f $RCNET_TEMP else dspmsg scripts.cat 244 "$PROGNAME: Unable to move old rc.net $RCNET_TEMP to $RCNET_BACKUP\n"\ $PROGNAME $RCNET_TEMP $RCNET_BACKUP clutils_log "Unable to move old rc.net $RCNET_TEMP to $RCNET_BACKUP" STATUS=1 TEMP_CLEAN="false" fi fi # We create a temporary file for rc.net irrespective of whether # we have some thing to change or not. So this code makes sure # we remove the temporary file when no error occurs if [[ -f $RCNET_TEMP ]] then if [[ $TEMP_CLEAN = "true" ]] then rm -f $RCNET_TEMP fi fi ################################################################################ # # Perform /etc/rc.nfs modifications # ################################################################################ RCNFS_FILE="/etc/rc.nfs" RCNFS_TEMP="/tmp/rc.nfs.$$" RCNFS_BACKUP="/etc/rc.nfs.orig" RCNFS_CHANGED="false" TEMP_CLEAN="true" cp $RCNFS_FILE $RCNFS_TEMP if [[ $? -ne 0 ]] then dspmsg scripts.cat -s 24 50 "%s: Unable to create backup copy of rc.nfs.\n" $PROGNAME clutils_log "Unable to create backup copy of rc.nfs" exit 1 fi trap err_rcnfs 1 2 3 # we always start by removing existing High Availability Cluster # Multi-Processing Version 4.1 for AIX stuff from rc.nfs # we'll add new stuff if called for cleanup_rcnfs if [[ $? -ne 0 ]] then # This needs a new NLS message catalog number dspmsg scripts.cat -s 24 60 "%s: error modifying rc.nfs.\n Original file saved as %s\n" $PROGNAME $RCNFS_TEMP >&2 clutils_log "error modifying rc.nfs. Original file saved as $RCNFS_TEMP" err_filesystem_full exit 1 fi if [[ "$ONOFF" = "true" ]] then setup_rcnfs rc=$? if [[ $rc -ne 0 ]] then if [[ "$rc" != "99" ]] then # This needs a new NLS message catalog number dspmsg scripts.cat -s 24 60 "%s: error modifying rc.nfs.\n Original file saved as %s\n" $PROGNAME $RCNFS_TEMP >&2 clutils_log "error modifying rc.nfs. Original file saved as $RCNFS_TEMP" err_filesystem_full fi exit 1 fi fi # flush buffer for /etc/rc.nfs # if [[ "$RCNFS_CHANGED" == "true" ]] then clutils_log "rc.nfs changed" syscall open $RCNFS_FILE 2 0 \; fsync \$0 \; close \$0 if cp $RCNFS_TEMP $RCNFS_BACKUP then rm -f $RCNFS_TEMP else dspmsg scripts.cat -s 24 70 "%s: Unable to move old rc.nfs %s to %s\n"\ $PROGNAME $RCNFS_TEMP $RCNFS_BACKUP clutils_log "Unable to move old rc.nfs $RCNFS_TEMP to $RCNFS_BACKUP" STATUS=1 TEMP_CLEAN="false" fi fi # We create a temporary file for rc.nfs irrespective of whether # we have some thing to change or not. So this code makes sure # we remove the temporary file when no error occurs if [[ -f $RCNFS_TEMP ]] then if [[ $TEMP_CLEAN = "true" ]] then rm -f $RCNFS_TEMP fi fi clutils_log "exit STATUS=$STATUS" exit $STATUS