0

I run this command to replicate data from one server to another. It's been working for a quite a while. I have this setup as a cron job. Yesterday for some reason, it stopped working. I ran it manually and got this error:

ssh -qt -p2123 user36@219.29.195.71 rsync -az --delete 
--rsh='ssh -p2122 -qt' 
/home/user36/public_html/ user36@142.112.62.206:/home/user36/public_html/

rsync: -p2122: unknown option
rsync error: syntax or usage error (code 1) at main.c(1231) [client=2.6.8]

Note that the full command is executed in a single line, but is shown here in multiple lines for better readability

Why did it suddenly stop working? And why is it throwing the error at the ssh port option?

EDIT: This is on CentOS

gAMBOOKa
  • 999
  • 6
  • 19
  • 34

3 Answers3

1

You'll need to add quotes around the command you pass via ssh:

ssh -qt -p2123 user36@219.29.195.71 "rsync -az --delete 
--rsh='ssh -p2122 -qt' 
/home/user36/public_html/ user36@142.112.62.206:/home/user36/public_html/"

This will keep the single-quotes from getting stripped out before rsync runs on the remote host.

Cakemox
  • 25,209
  • 6
  • 44
  • 67
0

Possibly it's stopped working due to a package upgrade but this works on Ubuntu/Debian:

rsync -e 'ssh -c blowfish -oPort=2212 -ax'

Jonathan Ross
  • 2,183
  • 11
  • 14
0

-p should be the argument for port number I usually put a space after it. If you connect in on port 2123 to run an rsync archive update with deletes against another server this time via port 2122.

My only suggestion is to try with a space after the -p and remove the -qt so:

ssh -p 2123 user36@219.29.195.71 rsync -az --delete --rsh='ssh -p 2122 ' /home/user36/public_html/ user36@142.112.62.206:/home/user36/public_html/

You could also try removing the -qt (-q for quiet and -t to Force pseudo-terminal allocation.) on one, or the other, or both commands. Ports 2123 and 2122 need to be open on the relevant firewalls if any.

Tomachi
  • 141
  • 1
  • 1
  • 7