Help - Search - Members - Calendar
Full Version: rsync help
Linuxhelp > Support > Technical Support
McKettle
Hello,

I'm hoping someone can help and that I have not posted this in the wrong place.

A client of ours requires a backup of their mySQL database done each night. At the moment a mysqldump is run on the server and e-mailed to us, we then ftp the compressed dump to another server. Recently the dump has exceeded our e-mail quota so now we just receive a link to the file. Asking around we were told about rsync so we could cron a rsync job to copy the dump to the other server automatically. I have been testing this and trying to get it to work but I can't manage it. This is what I have been trying.

rsync -zvr /(source) (Username)@(Address):/(destination) password:(password)

I SSH into our server and run the command and get the following error message

Unexpected remote arg: (Username)@(Address):/(destination)
rsync error: syntax or usage error (code 1) at main.c(1213) [sender=3.0.6]

As you may tell from above I am relatively new to linux so please be gentle with me regarding any terminology I have used incorrectly.

Thank you in advance.
michaelk
It appears that you are trying to run rsync over ssh. Check out the link below. Does the provided link include the file name or just the folder?
If it contains the name then you can use scp or use a ssh file browser like filezilla, nautilus or konqueror.
,
/www.cyberciti.biz/tips/linux-use-rsync-transfer-mirror-files-directories.html
McKettle
Hi,

It is for the whole folder not just one file. I can only connect into the backend of our the server via SSH.

I have gone through the site you linked and tried some of their examples but I get the same errors
michaelk
Then how do you connect to the server with the mysql dump?
McKettle
I have just found out that I have given you the wrong info.

It is just one file that needs to be copied not the whole folder.

We can access the servers via both SSH and FTP.

There is a script in place on the server already that runs the dump, I just need to either add another script to move that dump to another server.
michaelk
scp would be the most secure with public/private keys. If not then you can write an expect script but if you hard code the password save it with limited permissions.
Using ftp with expect would also work but since the passwords are sent as clear text I would only use it as a last resort.
McKettle
Really sorry for the delay in getting back to you on this.

I know you said it's the least safe... but what would the script be to FTP it to the other server?

Thank you
McKettle
Just found this, so will give it a go.


#!/usr/bin/expect
spawn ftp ftp.remotedomain.com
expect "Name (ftp.remotedomain:root):"
send "username\r" //provide the username here
expect "Password:"
send "password\r" //provide the password here
expect "ftp>"
send "lcd /var/log/httpd\r" //any desired location
expect "ftp>"
send "put *.acslog\r" //any file
expect "ftp>"
send "bye\r"
#interact
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.