I have a task that calls a Shell script. The Shell script is connecting to
a remote server with SSH. The SSH command makes use of environment
variables set on the pipeline.
from the Shell script...
echo "Stop Tomcat server on ${HOST}..."
ssh ${SSH_OPTS} ${SSH_USER}@${HOST} "sudo /sbin/service tomcat-${ENV} stop"
This task fails and when when I look at the logs I see that single quotes
have been added around the *${SSH_OPTS}* and where the code has double
quotes.
ssh '-o StrictHostKeyChecking=no -i ~/.ssh/my.pem' [email protected] 'sudo
/sbin/service tomcat-dev stop'
You can see that it does not add single quotes around *my-user* or
*myhost.com* variables. I've done other testing to confirm that it appears
that single quotes are only added to environment variables that contain
spaces.
HOWEVER...
I've also noticed that when this Shell script calls another Shell script
the *${SSH_OPTS}* value does not have single quotes added to it. So the
behavior does not seem to be consistent...
ssh -o StrictHostKeyChecking=no -i ~/.ssh/my.pem [email protected] 'ln -s
~/properties/my-dev.properties ~/properties/my.properties'
Both of the shell scripts run on the same server.
I've tried running the log output on the same sever and having two sets of
single quotes in the command causes a problem.
Does anyone have any suggestions to help resolve this issue? Thank you for
your help.
--
You received this message because you are subscribed to the Google Groups
"go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/go-cd/be383116-de5e-4a33-8dd5-cef77493bd02%40googlegroups.com.