禅道的所有数据都存在数据库里,所以只要备份好数据库就备份好了整个禅道系统。下面分享一下自己写的备份shell:
#!/bin/bash
DateNow=$(date +%Y%m%d)
BackupDir="/zentaoback/"
BackupLog="/zentaoback/zentaoback.log"
DataBase="zentao"
DBPasswd="123"
BackDir="root@172.1.1.1:/zentaoback/"
MysqlDump(){
echo "$DataBase's DB back begin---[`date +%Y-%m-%d/%H:%M:%S`]" >> $BackupLog 2>&1&&
if [ ! -x `which mysqldump` ];then
echo "No found mysqldump or No permit!"
exit 5
else
mysqldump -uroot -p$DBPasswd $DataBase > $BackupDir$DataBase$DateNow || echo "mysqldump error!"
&&
/usr/bin/scp $BackupDir$DataBase$DateNow $BackDir >> $BackupLog 2>&1&&
rm -rf $BackupDir$DataBase$DateNow >> $BackupLog 2>&1&&
/bin/echo "$DataBase's DB back end---[`date +%Y-%m-%d/%H:%M:%S`]" >> $BackupLog 2>&1
fi
echo " " >> $BackupLog 2>&1
}
MysqlDump