I built a rails deploy dashboard that kicks off a ruby script on a remote machine to update a deployed application.
The command to run the script looks like this:
ssh test-host-02
"wget -q -O - http://server/deploy.rb | sudo ruby"
> /tmp/update-test-host-02.log 2>&1
Now I need to pass arguments into the deploy.rb script. Such as which build to deploy.
What is the best way to pass arguments to deploy.rb?
Ruby follows the standard convention of allowing you to specify stdin input with
-, which allows you to pass arguments after.The double-dash isn’t necessary in most cases.
Another option is to use turn the output of wget into a file descriptor using bash’s
<()operator: