- #!/bin/bash
- date=`date +%Y%m%d`
- backDb=$date.sql
- backFile=$date.tar.gz
- backHost=135.26.25.36 #FTP服务器IP地址
- backUser=ftp #FTP服务器用户名
- backPwd= password #FTP密码
- /usr/local/mysql/bin/mysqldump dbname -udbuser -pdbpassword > /home/backup/$backDb
- echo -e "DB Backup Done!\n"
- tar -zcvf /home/phpeye/$backFile /websites/phpeye/
- echo -e "File Backup Done!\n"
- ftp -n $backHost<<!
- user $backUser $backPwd
- passive
- put /home/backup/$backDb phpeyebackup/$backDb
- bye
- !
- ftp -n<<!
- open $backHost 21
- user $backUser $backPwd
- port
- prompt
- put /home/phpeye/$backFile phpeyebackup
- bye
- !
- rm -f /home/web_happy/phpeye/$backDb
- echo -e "Backup Done!\n"