How to backup you data to remote FTP server daily
#!/bin/sh cd /root #dump the DB /usr/local/bin/mysqldump --opt --user=hxs --password=****** --host=localhost hxs > hxs.sql /usr/local/bin/mysqldump --opt --user=hxs --password=****** --host=localhost blog > blog.sql #tar the file tar -zcvf hxs.sql.tar.gz hxs.sql tar -zcvf blog.sql.tar.gz blog.sql tar -zcvf hxs.tar.gz /usr/local/www/apache24/data/hxs tar -zcvf blog.tar.gz /usr/local/www/apache24/data/blog #upload to the FTP ftp -v -n dedibackup-dc2.online.net << EOF user sd-66666 ****** type binary cd /backup put hxs.sql.tar.gz put hxs.tar.gz put blog.sql.tar.gz put blog.tar.gz bye EOF #del the local file rm -rf /root/*.tar.gz rm -rf /root/*.sql
save the code below as backup.sh under the /root
run:
chmod +x /root/backup.sh
run:
crontab –e
add:
00 05 * * * /root/backup.sh
阅读剩余
版权声明:
作者:John
链接:https://vps.la/2016/01/10/how-to-backup-you-data-to-remote-ftp-server-daily/
文章版权归作者所有,未经允许请勿转载。
THE END