Linux VPS下备份网站数据到ftp的一键脚本

乐清SEO_开发应用_Centos_ 乐清SEO2021-04-25 转载自:

代码如下:


#! /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