Regularly back up each server's shake data, to the FTP server, pay attention to the active mode and the passive mode difference
#!/bin/bash# active FTP is beneficial to server, client iptables shutdown, client needs to execute Passsiveh after uploading data # Passive FTP is beneficial to client, server side iptables off, Linux Client FTP login does not need to execute the passive command, can upload # #vim /etc/sysconfig/iptables# Open Firewall port active mode, the client firewall needs to shut down #-a input -p tcp --dport 20 -j accept#-a input -p tcp --dport 21 -j acceptyum install vsftpdvsftprun () {chkconfig vsftpd onservice vsftpd startchkconfig iptables off}vsftprunvim /etc/vsftpd/vsftpd.conf# Add anonymous user upload permissions #anonymous_enable=yes #anon_upload_enable =yes#anon_mkdir_write_enable=yes#anon_root=/var/ftproot#anon_umask=022#anon_other_write_ Enable=yeslocal_enable=yeswrite_enable=yeslocal_umask=022dirmessage_enable=yesxferlog_enable=yesconnect_from_ Port_20=yesxferlog_std_format=yeslisten=yespam_service_name=vsftpduserlist_enable=yestcp_wrappers=yesmkdir -p /var/ftproot/{upload,download}chmod 777 /var/ftproot/uploadvsftprun# Client Configuration yum INSTALL&NBSP;-Y&NBSP;FTP#FTP Remote backup file #!/bin/bashhost= "172.16.16.23" id= "Zhang" pw= "password" basedir= "/etc" ip_addr= ' ifconfig | grep ' inet Addr: ' | grep -v ' 127.0.0.1 ' | cut -d: -f 2 | awk ' {print $1} ' current_date= ' date +%y-%m-%d ' remotedir= "/var/ftproot/upload" backupfile= "' date +%Y- %m-%d '. etc.tar.gz "cd /tmptar -zcvf " $ip _addr "-" $backupfile " $basedirif [ $? -eq 0 ]; thenftp -n "$host" >/tmp/$ip _addr-etc-$current _date.log 2 >&1 <<EOFuser zhang passwordbinarycd "$remotedir" put "$ip _addr"-"$ Backupfile "put " $ip _addr "-etc-" $current _date ".logbyeeofelse echo "Tar false" fi
You can also turn on uploading files using anonymous logins
This article is from the "Potato It" blog, be sure to keep this source http://malin314.blog.51cto.com/7206614/1865848
Linux FTP Remote backup shell script command