Linux VPS下备份网站数据到ftp的一键脚本
复制代码
代码如下:
#! /bin/bash
cd /home/www/deepvps
mysqldump –all-databases -uroot -ppass |gzip > mysql_backup.tar
tar -zcvf files_backup.tar.gz /home/www/deepvps/* –exclude=*.tar.gz
ftp -vn x.x.x.x << autoftp
user name pass
type binary
put mysql_backup.tar mysql_backup.tar
put files_backup.tar.gz files_backup.tar.gz
close
quit
autoftp
赞 (0)