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

Putty Problems

Options
  • 23-03-2008 3:58am
    #1
    Closed Accounts Posts: 100 ✭✭


    Any help on this would be greatly appreciated....

    Im trying to ssh onto a node using putty through the windows command line and run a few commands.

    If i type,

    putty -ssh -load LOG 10.xx.xx.xx -l username -pw password

    (LOG is a Saved session that writes log files)

    I get onto the node in question and can manually type in the commands i need to.

    So now i want to run in these commands automatically, so i thought i could type;

    putty -ssh -load LOG 10.xx.xx.xx -l username -pw password -m Command.txt

    Where Command.txt is a one line file that contains a command that i want to run, ie;

    ~~~~Command.txt~~~~
    random_command
    ~~~~~~~~~~~~~~~~

    However when i do this nothing happens! I checked the Log file and it looks like this:

    ~~~~Logfile.log~~~~
    =~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2008.03.23 01:57:38 =~=~=~=~=~=~=~=~=~=~=~=
    login as: username
    username@10.xx.xx.xx's password:
    bash: random_command: command not found

    ~~~~~~~~~~~~~~

    Does anybody have any suggestions? I've tried a few variations but my head is completely wrecked at the moment.

    Cheers in advance.


Comments

  • Subscribers Posts: 4,076 ✭✭✭IRLConor


    Is random_command in your $PATH on the machine?

    What is the value of $PATH when running the command via -m?

    Try specifying the full path to random_command (e.g. /usr/bin/random_command). This is probably a good idea anyway because you never know when you might change your $PATH in the future.


  • Registered Users Posts: 3,886 ✭✭✭cgarvey


    Another vote for the 'use full path', because when you login interactively your path could be set (e.g. in ~/.bashrc) to a different path to the system default, or what not.


  • Registered Users Posts: 1,523 ✭✭✭machalla


    Have you looked at plink?

    http://the.earth.li/~sgtatham/putty/0.58/htmldoc/Chapter7.html

    Try something like this from the command line in windows.
    C:\Program Files\PuTTY\plink.exe "192.168.1.19 -l bob ./run.sh"

    Should run the remote script run.sh. I have used plink to run scripts on remote scripts in the past from windows. Its part of the putty tools on their homepage.

    Might be some help.


  • Closed Accounts Posts: 100 ✭✭JuJuYNWA


    Thanks very much for the help guys. It did indeed work when i put in the full path.

    Cheers,

    J:)


Advertisement