Thursday, April 28, 2011

CachéDB/EPIC HP Business Copy Script

Finally figured out a way to execute pairresync, pairsplit, EPIC's InstFreeze and InstThaw from the proxy backup server.

HORCMINST=1
HORCC_MRCF=1
#
logFile=/tmp/`basename $0`_`date '+%a'`.log
#
# Issue the resync
date '+%X_About to resync" >$logFile
pairresync -g dbgroup -IBC1 >>$logFile
#
# Wait for the resync to complete
#
date '+%X_Waiting for resync" >>$logFile
while true ; do
if [[ `pairdisplay -g dbgroup -IBC1 | egrep -c 'COPY|PSUS|SSUS'` -eq 0 ]] ; then
date '+%X_Resync Complete" >>$logFile
break
fi
sleep 20
done
#
sleep 60
#
# Freeze the Epic system
date '+%X_About to Freeze" >>$logFile
ssh epicserver "/epic/prd/bin/instfreeze;sync;sync;sync" >>$logFile
sleep 15
date '+%X_About to Split" >>$logFile
pairsplit -g dbgroup -IBC1 >>$logFile
sleep 15
date '+%X_About to Thaw" >>$logFile
ssh epicserver /epic/prd/bin/instthaw >>$logFile
sleep 15
date '+%X_All Done" >>$logFile

Tuesday, April 05, 2011

Backup Logs - Last 14 Days Of Any Given Server

Auditors want these backup log reports all the time. Here a short script to display the last 14 days of backup logs for any given server.

select entity, date(start_time) as StartDate, time(start_time) as StartTime, date(end_time) as EndDate, time(end_time) as EndTime, activity, cast(bytes/1024/1024/1024 as decimal(18,2)) as GB, successful from summary where entity like '%$1%' and end_time >= current_timestamp-336 hours order by entity asc

Save this code as a TSM script and run it using the following syntax:

run script-name server-name

AIX Last Login Information

for user in ` lsuser -a time_last_login ALL| grep -v =` ; do
echo “$user NEVER”
done


for user in `lsuser -a time_last_login ALL| grep =|sed 's/ time_last_login=/:/'` ; do
last=`echo $user|cut -d: -f2`
id=`echo $user | cut -d: -f1`
echo "$id `perl -le \"print scalar localtime $last \" `"
done