Script Source Code for "cimage_migrate.ksh.orig"

This document contains the source code for the Disaster Recovery script "cimage_migrate.ksh.orig".



#!/bin/ksh

#### 
#### Check the time of day
#### If it is 1700 or later then schedule the script to begin execution
#### the next day at 0500
####  

if [[ `date +%H` -gt 16 ]]

	then
		echo /usr/local/scripts/cimage_migrate.ksh | at 5:00 am tomorrow
fi
#### 
#### Check to see if the COUNTER control file exists
#### If if exists, then user the value inside the COUNTER control file
#### If it does not exits, default to a COUNTER value of 10
#### 

if [[ -f /usr/local/scripts/counter ]]
	
	then
		count=`cat /usr/local/scripts/counter`

	else
		count=11
fi

# If the COUNTER value is less that 100 then execute the following lines

#if [[ ${count} -lt 100 ]]

while [[ ${count} -lt 100 ]]

do	
		/usr/lpp/adsm/bin/dsmmigrate -R -D /cimage/storage/arms/${count}*

#### 	
#### Check the time, if after 1600, then schedule script to execute
#### the next day at 0500 
#### 

		if [[ `date +%H` -gt 16 ]]
			
			then 
				echo /usr/local/scripts/cimage_migrate.ksh | at 5:00 am tomorrow
				print $((count = count + 1)) > /usr/local/scripts/counter
				kill $$
				exit 0
		fi

		print $((count = count + 1)) > /usr/local/scripts/counter

	else
	
		if [[ `date +%H` -gt 16 ]]
         
		               then 
                                echo /usr/local/scripts/cimage_migrate.ksh | at 5:00 am tomorrow
                               	print $((count = count + 1)) > /usr/local/scripts/counter 
				kill $$
                                exit 0
		fi

		count=10
		/usr/lpp/adsm/bin/dsmmigrate -R -D /cimage/storage/arms/${count}*
		print $((count = count + 1)) > /usr/local/scripts/counter
done

exit 0

This file last modified 11/02/10