5.5 drd sync system shutdown script

To run the following script during system shutdown, create the script in the /sbin/init.d directory and create a symlink to it from /sbin/rc[n].d/K[mmm]. The system administrator can choose values for n and mmm to ensure that file updates made during shutdown occur before the script is run. The script must be run before file systems are unmounted, which is generally done by /sbin/ rc0.d/K900localmount. See rc(1) for further information on rc script numbering.

#!/sbin/sh

#

#synchronize source root group with cloned root group

#drd-sync(1M).

#

PATH=/sbin:/usr/sbin:/usr/bin:/opt/drd/bin export PATH

rval=0

DRD_MOUNT_PT=/var/opt/drd/mnts/sysimage_001

set_return() {

if [ $1 -ne 0 ]; then echo $2

rval=1

fi

}

case $1 in stop_msg)

echo "Running drd sync to synchronize cloned root file systems"

;;

stop)

# Synchronize the source disk with the cloned system

drd mount >/dev/null 2>&1 # Ignore errors, may already be mounted. drd sync

sync_ret=$?

set_return $sync_ret "ERROR: Return code from drd sync is $sync_ret" rm -f $0 ${DRD_MOUNT_PT}$0 > /dev/null 2>&1

[[ -x $0 ]] && \

set_return 1 "ERROR: The $0 script (on image being shut down) could not be removed." [[ -x ${DRD_MOUNT_PT}$0 ]] && \

set_return 1 "ERROR: The ${DRD_MOUNT_PT}$0 script ($0 on clone) could not be removed." drd umount >/dev/null 2>&1 # Ignore errors.

;;

*)

echo "usage: $0 { stop_msg stop }" rval=1

;;

esac

exit $rval

5.5 drd sync system shutdown script

31

Page 31
Image 31
HP Dynamic Root Disk (DRD) manual Drd sync system shutdown script