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
- Running a batch script which will compile my codes and encapsulate in a zip file.
- Copy the zip file to a remote linux server.
- At the linux box, I need to deploy my application by unzipping the archieve
- 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.
Here the
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.
Hope it helped you in your critical time. Share your thoughts on this.
Did you consider using PowerShell? I have seen it this way:
ReplyDeleteUse PowerShell for all your windows stuff
Let it execute a unix shell script on the unix box
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.
DeleteThanks for your comment vaia. :) It always inspires me :)