Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

running commands from local bash script on remote machine

  • 16-03-2009 11:25am
    #1
    Registered Users, Registered Users 2 Posts: 528 ✭✭✭


    Hi All,

    I have a script on my local machine. When I run the script it opens up Putty and connects to a remote location through ssh. Now the problem I am having is then running commands from my local script in the remote location. No matter what I seem to try in the script nothing seems to happen in the remote console. Its probably something relatively easy that I am missing here but I have looked up a few things on the web and nothing seems to work for me.

    All I basically want to do is ssh from my current location to another one and then change into the relevant directory on the new console and then run a script that is stored in the remote location. The output of this script then creates some files that I then want to save/transfer back on my local machine.


    Any advice would be greatly appreciated.

    Thanks in advance,
    Eoin


Comments

  • Closed Accounts Posts: 1,444 ✭✭✭Cantab.


    Please post the script.


  • Registered Users, Registered Users 2 Posts: 2,426 ✭✭✭ressem


    1) ssh from my current location to another one
    2) and then change into the relevant directory on the new console
    3) and then run a script that is stored in the remote location.
    4) The output of this script then creates some files that I then want to save/transfer back on my local machine.

    In your script are you using putty.exe or putty's plink.exe program?

    Something like

    plink user@host "cd mydirectory; ./myscript "
    pscp -batch user@host:/home/user/mydirectory/myoutput c:\temp


  • Registered Users, Registered Users 2 Posts: 528 ✭✭✭ridonkulous


    Im using putty.exe


  • Registered Users, Registered Users 2 Posts: 528 ✭✭✭ridonkulous


    Sorry I can't put up the script as it contains nothing but sensitive data but I just realised its not the script that is the problem its running the commands in putty that seems to be causing the problem. Im just googling some stuff now but I haven't found a solution yet. If anyone can help me out or has knowledge of running scripts through Putty I would be extremely grateful. Basically all I have working at the minute is the execution of putty and the putty login. The remainder of the script then does not run in putty but when I end the putty session the script attempts to run on my local machine.


  • Registered Users, Registered Users 2 Posts: 2,426 ✭✭✭ressem


    Putty's plink.exe and pscp?

    http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html


    plink is the console version of putty for non-interactive logins.
    http://the.earth.li/~sgtatham/putty/0.60/htmldoc/Chapter7.html#plink

    pscp is the remote file transfer over ssh application.
    http://the.earth.li/~sgtatham/putty/0.60/htmldoc/Chapter5.html#pscp


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 528 ✭✭✭ridonkulous


    Thanks for that Im using plink now and some of the stuff is now working as expected. I do still have one problem when I attempt to ssh into another console but its more a syntax problem more than anything else I think. Thanks again.


Advertisement