This script generates a list of informix db backup files to be archived and archives them with netbackup
#!/bin/sh
TEMPF=/tmp/lms_nb_lock
LOG=/apps/informix/9.40/ifx_netbackup.log
# initally check for lock file
if [ -e ${TEMPF} ] ; then
OLD=`find ${TEMPF} -mtime +1`
# ok, lock file exists, is it one day old
echo string is ${OLD}
if [ -z "${OLD}" ] ; then
echo Error, lock file exists, aborting
exit -1
else
# yes the lock file is one day old, remove lock file
echo Error, Removing lock file, please check for runaway bparchive processes mail -s "Informix Netbackup" pvalentino@pvalentino.org
rm -f ${TEMPF}
fi
else
# ok, no lock file , lets run
touch ${TEMPF}
date > ${LOG}
if `onstat -c grep prod1` ; then
FILELIST=/backup_fs/informix/lms_prod1/*prod1_tape*.* && FILES=prodfiles
elif `onstat -c grep inact` ; then
FILELIST=/backup_fs/informix/lms_inact/*inact_tape*.* && FILES=inactfiles
else
FILELIST=/backup_fs/informix/lms_web/*web_tape*.* && FILES=webfiles
fi
for i in `ls $FILELIST`;do
echo "$i" >> /tmp/$FILES
/usr/openv/netbackup/bin/bparchive -S vortex.pvalentino.org -p lmsdb_database_archive -s UserArchive -L /apps/informix/9.40/ifx_netbackup.log -w 0 -f /tmp/$FILES mail -s "`hostname` db netbackup" admin@mydomain.com
rm -f /tmp/$FILES
rm -f ${TEMPF}
done
exit 0
No comments:
Post a Comment