root@cloud-adm:/backup# cat backupDay
#!/bin/bash
# Incremental Backup
#d=`date +%y%m%d%H%M%S`
d=`date +%a`
s=$1
lftp -c "open -u userID,password 1.1.1.999/userID; rm -r /userID/$s/$d"
mysqldump -ususer -pez=DatabaseName $2 > /backup/$2.sql
mysqldump -ususer -pez=DatabaseName erp > /backup/erp.sql
tar -jvcf /backup/$2.tar /backup/$2.sql
ncftpput -m -u userID -p password 1.1.1.999 /userID/$s/$d/db_dump /backup/*.*
ncftpput -R -m -u userID -p password 1.1.1.999 /userID/$s/$d/attachment /erp/$2
#ncftpput -R -m -u userID -p password 1.1.1.999 /userID/$s/$d/attachment /erp/$2
ncftpput -m -u userID -p password 1.1.1.999 /userID/$s/$d/code/layout /erp/*.*
ncftpput -m -u userID -p password 1.1.1.999 /userID/$s/$d/code/css /erp/css/*.*
ncftpput -m -u userID -p password 1.1.1.999 /userID/$s/$d/code/js /erp/js/*.*
ncftpput -m -u userID -p password 1.1.1.999 /userID/$s/$d/code/images /erp/images/*.*
ncftpput -m -u userID -p password 1.1.1.999 /userID/$s/$d/code/fonts /erp/fonts/*.*
ncftpput -R -m -u userID -p password 1.1.1.999 /userID/$s/$d/code/java /erp/WEB-INF
rm $2.sql
backupDay CompanyName DatabaseID
沒有留言:
張貼留言