Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to automatically back up data to remote host FTP by Linux VPS

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article "Linux VPS how to achieve automatic backup of data to remote host FTP" article knowledge point most people do not understand, so Xiaobian summarized the following content for everyone, detailed content, clear steps, with a certain reference value, I hope you can read this article to gain, let's take a look at this article "Linux VPS how to achieve automatic backup of data to remote host FTP" article bar.

If there is no ftp command on the system, run yum install -y ftp to install first.

You need to create the/home/backup/directory first, which cannot be used for other purposes.

The copy code is as follows:

#!/ bin/bash

#ftp information

ftp_ip=

ftp_user=

ftp_pass=

#Backup database

/etc/init.d/mysqld stop

mysqlbakname=mysql_$(date +"%y%m%d").tar.gz

tar zcf /home/backup/$mysqlbakname /var/lib/mysql

/etc/init.d/mysqld start

#Backup website

webbakname=web_$(date +%y%m%d).tar

tar cf /home/backup/$webbakname /home/www

#Operation ftp

oldmysql=mysql_$(date -d -1day +"%y%m%d").tar.gz

oldweb=web_$(date -d -1day +"%y%m%d").tar

cd /home/backup/

/usr/bin/ftp -v -n $ftp_ip

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report