Webserver Backup to other server


Recommended Posts

Ok, I'm a complete noob when it comes to doing anything in terminal, or known what terms to use. So, if someone can help me understand what and how, that would be awesome.

I have two servers.

US1 = CentOS with cPanel

US2 = CentOS with Kloxxo

I have an account on US1 which is a vBulletin board. I'd like to be able to automatically backup that account daily to US2. I need the entire account.

Is there a way to do this easily, on the daily, automatically across the two servers?

Both servers are on the same network, and have an internal IP address.

192.168.1.101 / 102 for the servers.

I appreciate any help greatly.

Link to comment
https://www.neowin.net/forum/topic/1154260-webserver-backup-to-other-server/
Share on other sites

That is definitely possible. In fact, CPanel has a backup option built in if I remember correctly. You could probably setup automatic backup through CPanel, then setup a cron job on that server to mount the backup directory on the other server using rsync over ssh. I can provide specific commands if you want, but you should have no problem piecing together the procedure I described from guides elsewhere online.

Alright, so here/s what I'm trying to do, and the problems I'm having.

Using this command:


rsync -P XXXX -avz -e ssh /home/site [email protected]: /home/name/site
[/CODE]

I get the following error:

[CODE]
Unexpected remote arg: [email protected]:
rsync error: syntax or usage error (code 1) at main.c(1213) [sender=3.0.6]
[/CODE]

What am I doing wrong here?

The rsync command should look something like this:


rsync -aPvz -e "sshpass -p 'mySSHPasswordHere' ssh -p 22" /home/site [email protected]:/home/name/site
[/CODE]

In the command above I interpreted what I think you meant to do. According to the rsync man page '-P' is equivalent to '--partial --progress', but it looks like you were trying to use it to specify your SSH password. The OpenSSH client does not allow you to specify your password on the command line for security reasons, but if you really need to you can use the sshpass utility, which is what I did in the above command. However it would be much better if you used key-based SSH login instead, in which case you could remove the "sshpass -p 'mySSHPasswordHere'" from the command and just have "ssh -p 22" instead. Read this wiki page on key-based SSH login to learn how to set that up. When done correctly you will be able to SSH into the remote host without being prompted for a password.

Thanks for that.

I am just playing around with getting the keys to work. In the meantime though.


rsync -aPvz -e ssh -p 22" /home/site [email protected]:/home/name/site
[/CODE]

Am I correct to assume the -p 22 is the port?

That is correct; "-p 22" specifies the port. 22 is the default port for SSH, so you could technically leave that off and still have no problems. You can find the manual page for rsync here and the one for the OpenSSH client here.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.