I have a script located on a remote server. It's in the following directory:
/usr/local/bin/myscript.sh.
I can execute the script locally on the server with:
/usr/local/bin/myscript.sh computername $env1 $env2
How can I execute this script remotely with SSH? The environment variables are stored in /etc/profile on the remote server. I get the error not enough arguments when running the following command locally:
ssh remoteserver -C "sh /usr/local/bin/myscript.sh computername $env1 $env2"
Update
I also get this error when using
ssh remoteserver -C 'sh /usr/local/bin/myscript.sh computername $env1 $env2'
Update 2
I got it working after I sourced my environment variables:
ssh salt -C 'source /etc/profile && sh /usr/local/bin/myscript.sh computername $env1 $env2'