HPE Storage Users Group
https://3parug.com/

SSH scripting and Putty
https://3parug.com/viewtopic.php?f=17&t=698
Page 1 of 1

Author:  Mikko [ Mon May 05, 2014 10:19 am ]
Post subject:  SSH scripting and Putty

Good day,
I am very new to scripting but interested in learning more.
I have to do my 3par scripting with putty via SSH. I created the public/private keys but when I execute putty from command line and give an external file (my script) as an argument it just says "unprintable characters in command". The script works fine if I execute it interactively. Is this a putty- related issue or something else? '
Also, is it possible to execute multiple commands from one external file? What is the best practice using SSH?
Thank you very much for your help!

Author:  apol [ Wed May 07, 2014 3:01 am ]
Post subject:  Re: SSH scripting and Putty

Hi,

when you use kitty (beefed up putty) instead of plain putty, there is a "send script file" option in the menu. But this way isn't that good for real scripting, it just dumps the whole file as is. This can be a problem with commands that start a task (which you have to wait for before going on), or if you put some logic in your scripts. Error handling, loops, etc.

I prefer the ssh-cli for interactive working, but use a local installed cli for scripting.

But to be honest, I'm not a very savvy user of putty or kitty, so there might of course be a way to do better than I do :?

Author:  Richard Siemers [ Wed May 07, 2014 5:49 pm ]
Post subject:  Re: SSH scripting and Putty

Putty is intended to be an interactive GUI.
plink (part of putty) is the command line version.

Try plink with your -m script.

Author:  hdtvguy [ Fri Jun 13, 2014 5:38 am ]
Post subject:  Re: SSH scripting and Putty

Any reason why you have to do it via SSH and not via the CLI? The CLI is extremely powerful and has numerous features to make life easy for scripting.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/