Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

Putty Problems

  • 23-03-2008 03: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,084 ✭✭✭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, Registered Users 2 Posts: 3,890 ✭✭✭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, Registered Users 2 Posts: 1,528 ✭✭✭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
Advertisement