[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
help with rsync and Missing trailing-" in remote-shell command.
From: |
dpich |
Subject: |
help with rsync and Missing trailing-" in remote-shell command. |
Date: |
Fri, 17 Jun 2016 13:57:33 -0700 (PDT) |
User-agent: |
G2/1.0 |
I have three servers. nginx00 (master nginx server) and nginx01 and nginx02
(slave nginx servers).
nginx00 is a staging environment that I do testing on. Once it goes live I run
a bash script that syncs the config files and restarts the nginx daemon. It's
working fine as root. However, I am bound by rules in my company to run
commands as users and not the root user.
I have setup keys for ssh for all my sysadmin users, and it works fine if I
just us it.
rsync -q -avz --delete -e 'ssh -i /home/dpich/.ssh/id_rsa' --rsync-path='sudo
rsync' /etc/nginx/ dpich@balancer01:/etc/nginx/
If I run it in this bash script...
#!/bin/bash
currentuser=$(whoami)
OPTS=(-q -avz --delete -e \'ssh -i /home/$currentuser/.ssh/id_rsa\'
--rsync-path=\'sudo rsync\')
SRC=(/etc/nginx/)
RSYNC_CMD=(rsync)
for h in nginx0{1..2} ; do
DST=$currentuser'@'$h':/etc/nginx/'
rsync ${OPTS[@]} ${SRC} ${DST}
done
I keep getting this error:
dpich@nginx00:~$ /usr/sbin/deploy2.sh
Missing trailing-" in remote-shell command.
rsync error: syntax or usage error (code 1) at main.c(430) [sender=3.1.1]
Missing trailing-" in remote-shell command.
rsync error: syntax or usage error (code 1) at main.c(430) [sender=3.1.1]
dpich@nginx00:~$
I'm 1000% convinced it has to do with quotes, but I haven't been able to solve
this.
Any help would be appreciated.
- help with rsync and Missing trailing-" in remote-shell command.,
dpich <=