tiptop自动备份脚本backup.sh
#建立crontab排程
crontab -e
0 12,23 * * * sh /u3/backup/tool/backup.sh #每天12点23点自动备份
0 6 * * * sh /bin/ftpauto #每天早晨六点自动上传
#backup.sh
LANG=en_US
ans=`date|awk '{print $1}'`
case $ans in
Mon) cd /u3/backup/Mon;;
Tue) cd /u3/backup/Tue;;
Wed) cd /u3/backup/Wed;;
Thu) cd /u3/backup/Thu;;
Fri) cd /u3/backup/Fri;;
Sat) cd /u3/backup/Sat;;
Sun) cd /u3/backup/Sun;;
esac
TIME=`date ' %Y%m%d%H%M'`
if [ "`date ' %H'`" = "12" ]
then
rm -rf *
fi
for f in ds ds1
do
unload.sh ${f}
tar czvf ${f}.tar.gz ${f}.tmp
mv ${f}.tar.gz ${f}_$TIME.tar.gz
exp ${f}/${f} file=exp_${f}.dmp
mv exp_${f}.dmp exp_${f}_$TIME.dmp
droptemp_auto ${f} ${f}
done
if [ "`date ' %H'`" = "23" ]
then
tar czvf topprod.tar.gz /u1/topprod
ftpauto #自动上传
tar rvf /dev/st0 ds1*.tar.gz
fi
rm -rf *.tmp
关键词标签:tiptop,backup.sh