04-04-2011 02:13 PM
I'm using telnet/ssh for switch administration. Sometimes I have to issue repetitive commands with loooong list of arguments. That's boring and error-prone. Can I use scripts for that purpose?
I mean scenarion similar to the following:
1. I create text file on my PC
2. Then upload the file to the switch
3. Then run the script from a file.
Is it possible?
04-05-2011 09:34 AM
Thanks TechHelp24 for the flower as we say in Germany...
Perl gives you a huge bunch of packages to automate this kind of jobs.
I use the Net::SSH:Perl package and some self made function to format the returning output.
A simple way is to use a Linux or a Unix box for this tasks. It is very difficult to get a Perl SSH session running on a Windows box.
Cygwin is one way for Windows.
Running an automated SSH session is a bit different compared what you are asking for.
There is no need for uploading files into the switch FS and pushing the results back to an FTP server.
You need a function which creates a ssh object with an IP address, Username Password and one or more commands.
The function will return the command output. In addition you need some error reporting as well.
I hope this helps,