Scientific Linux是重新编译的Red Hat Enterprise Linux,由费米国家加速器实验室、欧洲核研究组织以及世界各地的大学和实验室共同开发。它旨在与Red Hat Enterprise Linux完全兼容,也强调自主方便的定制,用户可以根据自己的需求做相应修改,可以使用脚本或者Anaconda给自己定制最小化的安装模式。
全部博文(89)
分类: BSD
2011-04-04 01:53:24
#(当然是从网上抄,并按自己需要改的)
#!/bin/bash
BackupPath=/home/zx/data_bk
Mysql_bk_dir=$BackupPath/mysqlbk
if [ ! -x $BackupPath ]
then
mkdir "$BackupPath"
fi
if [ ! -x $Mysql_bk_dir ]
then
mkdir "$Mysql_bk_dir"
fi
LogFile=$BackupPath/backuplog
echo "Today is $(date +%Y%m%d),Begin to backup extmail files!" >> $LogFile
####################################################################
# define mysql variables
####################################################################
NewFile="$Mysql_bk_dir"/mysql$(date +%Y%m%d).tgz
DumpFile="$Mysql_bk_dir"/mysql$(date +%Y%m%d).sql
OldFile="$Mysql_bk_dir"/mysql$(date -v -5d +%Y%m%d).tgz
####################################################################
# mysql backup proccess
####################################################################
#Delete Old File
if [ -f $OldFile ]
then
rm -f $OldFile >> $LogFile 2>&1
echo "[$OldFile]Delete Old File Success!" >> $LogFile
else
echo "[$OldFile]No Old Backup File!" >> $LogFile
fi
if [ -f $NewFile ]
then
echo "[$NewFile]The Backup File is exists,Can't Backup!" >> $LogFile
else
cd $Mysql_bk_dir
mysqldump -uroot -p'****密码不能写出来的' --opt extmail > $DumpFile
tar czf $NewFile mysql$(date +%Y%m%d).sql >> $LogFile 2>&1
echo "[$NewFile]Backup Success!" >> $LogFile
# rm -rf $DumpFile
fi
cd ..
tar zcvf nou_$(date +%Y%m%d)_usr_local_etc.tar.gz /usr/local/etc/
echo " nou_$(date +%Y%m%d)_usr_local_etc.tar.gz backup finished!" >> $LogFile
tar zcvf nou_$(date +%Y%m%d)_usr_local_slockd.tar.gz /usr/local/slockd/
echo " nou_$(date +%Y%m%d)_usr_local_slockd.tar.gz backup finished!" >> $LogFile
tar zcvf nou_$(date +%Y%m%d)_usr_local_ /usr/local/www/
echo " nou_$(date +%Y%m%d)_usr_local_ backup finished!" >> $LogFile
echo "Extmail files backup finished!" >> $LogFile