Feature: automatic backup between remote servers
Most O & M personnel know the advantages of rsync backup. Simply put, only modified files are backed up to reduce the amount of data transmitted. At the same time, it can transmit data through the SSH protocol for data security.
However, SSH has a disadvantage. Only the password can be entered in interactive mode. As a result, the backup program cannot be written to crontab and can only be executed manually. Automatic batch processing is not supported.
Sshpass can decrypt this disadvantage. Let's take a look:
: Http://sourceforge.net/projects/sshpass/files/
Decompress the package./configure; Make; make install to complete the installation.
Usage:
Sshpass-P 'Password' rsync-AV-e SSH localdir username @ remoteaddr:/remotedir or
Sshpass-F password. File rsync-AV-e SSH localdir username @ remoteaddr:/remotedir
Password: Remote Server Password
Password. File: the password file.
Localdir local directory to be backed up
Username Remote Server Username
Remoteaddr Remote Server IP address or remote server Domain Name
Remotedir remote server path
PS:
The Rsync exclusion directory syntax is -- explode = directory name. In actual tests, the directory name cannot be an absolute address.