root@a05scpgapp01/>cat /sysbak/cpg-hkp-01.sh
#! /bin/sh
# Function: To keep the house keeping,
# delete the 7 days ago files.
# Author: Sheng Huiping
# Date: Apr 12 2011
# backup the file
Dir=/home/dbsrun
Date=`date +'%Y%m%d%H%M%S'`
cd $Dir
tar -cvf finacle.tar finacle
mv -f /home/dbsrun/finacle.tar /osbak/finacle$Date.tar
tar -cvf sfs.tar sfs
mv -f /home/dbsrun/sfs.tar /osbak/sfs$Date.tar
tar -cvf tomcat.tar tomcat
mv -f /home/dbsrun/tomcat.tar /osbak/tomcat$Date.tar
tar -cvf monitorcpg.tar monitorcpg
mv -f /home/dbsrun/monitorcpg.tar /osbak/monitorcpg$Date.tar
sleep 20
cd ./dbsrun
tar -cvf topcpg.tar topcpg
mv -f /home/dbsrun/dbsrun/topcpg.tar /osbak/topcpg$Date.tar
tar -cvf smpfe.tar smpfe
mv -f /home/dbsrun/dbsrun/smpfe.tar /osbak/smpfe$Date.tar
tar -cvf NCPS.tar NCPS
mv -f /home/dbsrun/dbsrun/NCPS.tar /osbak/NCPS$Date.tar
tar -cvf bepsfile.tar bepsfile
mv -f /home/dbsrun/dbsrun/bepsfile.tar /osbak/bepsfile$Date.tar
sleep 10
# Do the file house keeping
cd /osbak
find . -mtime +7 -exec rm -rf {} \;
# Check the status:
if [ $? == 0 ]; then
echo " The house keeping is okay !"
else
echo " error accur, Please check again ....."
fi