Executing a remote shell file from windows

Well... its something really simple but couldn't find the proper way to do. All I wanted to do is
  1. Running a batch script which will compile my codes and encapsulate in a zip file.
  2. Copy the zip file to a remote linux server.
  3. At the linux box, I need to deploy my application by unzipping the archieve
  4. And finally running other commands to manage something more.
Problem was I was not sure about how to initiate a command in my linux box from windows batch script.

Finally found plink with the help of Mr.Yann Ramin in stackOverFlow
scp -p -pw password code-archieve.zip user@remote.host.com:/opt/code
plink -pw password user@remote.host.com cd /home/user/Documents;./doTheJob.sh



Here the plink is actually 
  • logging in to the remote server
  • Changing directory to where the script file resides [cd /home/user/Documents]
  • running the shell script [./doTheJob.sh]
Note that how we are concatenating multiple shell commands in a single line by separating with semicolon.


Hope it helped you in your critical time. Share your thoughts on this.

Comments

  1. Did you consider using PowerShell? I have seen it this way:

    Use PowerShell for all your windows stuff
    Let it execute a unix shell script on the unix box

    ReplyDelete
    Replies
    1. Yes vaia, i saw the Powershell but didnt try this feature there. I can see invoke-command there. So I must going to try it out and will be sharing about this.
      Thanks for your comment vaia. :) It always inspires me :)

      Delete

Post a Comment

Popular posts from this blog

Ajax form submission with tiny MCE editor

Highcharts for Agile development

Try the "try" method and get rescued