Automation of command(s) to NI/NX controllers via telnet/SSH
marting
Junior Member
Hi all,
Been trying to figure out a way to automatically send one or more (ideally more) commands to a controller via telnet/SSH. Putty and its brother plink are both supposed to support this. However, when I try the commands that are supposed to work:
putty [controller] -ssh -l administrator -pw [password] -m asdf.txt (where asdf.txt has one or more commands)
plink [controller] -ssh -l administrator -pw [password] [AMX_telnet_command]
...I get no love:
FATAL ERROR: Server refused to start a shell/command
Any ideas on what can be done to make this work? Also open to other solutions that would let me do this.
Been trying to figure out a way to automatically send one or more (ideally more) commands to a controller via telnet/SSH. Putty and its brother plink are both supposed to support this. However, when I try the commands that are supposed to work:
putty [controller] -ssh -l administrator -pw [password] -m asdf.txt (where asdf.txt has one or more commands)
plink [controller] -ssh -l administrator -pw [password] [AMX_telnet_command]
...I get no love:
FATAL ERROR: Server refused to start a shell/command
Any ideas on what can be done to make this work? Also open to other solutions that would let me do this.
Comments
-
Haven't tried this yet, but it works well for other stuff...
https://github.com/ansible/ansible
Let us know when you get the profiles all written! -
That seems awfully heavy for what I'm trying to do. Especially since we're Windows-based and the Ansible control system has to be Linux.
I had limited success with the following:
ECHO [AMX_telnet_command] | plink [controller] -ssh -l administrator -pw [password]
This works for sending a single command to an NI (i.e. reboot). Unfortunately, on the NXes, it doesn't even work for that... Still playing around with and open to other options if anyone has suggestions! -
Perhaps another approach would be to write your own telnet port from within the Netlinx program. That way you can easily manage the API
-
Hi Marting, give Indigo Terminal Emulator from http://www.shadeblue.com a go. This has commands, macros and events.
-
If you're handy with the command line from a Unix system, look at the "expect" command.
-
KiTTY!
I was able to do what I need using KiTTY which is based on a fork of putty (www.9bis.net/kitty/).
Examples
Rebooting a controller:
kitty [hostname] -ssh -l [username] -pw [password] -cmd reboot
Wiping the URL list on a controller (up to 10 entries):
kitty [hostname] -ssh -l [username] -pw [password] -cmd "set url\nD\nD\nD\nD\nD\nD\nD\nD\nD\nD\n" -
I was doing something similar a while ago telnetting into touch panels, and sending a command, parsing its output, and then displaying it on the panel. I used this to get the time until the battery died, which was only available using the batt command at the touch panel shell. This was from code though, not from a laptop. My suggestion would be to FTP the text file of commands to the master, then start a telnet session in code to the master, and run each command, parsing output if needed. I haven't tried it on a master, but for the panels it worked, so I don't see why it wouldn't on a master. That is only one way, I'm sure there are many others.
Paul
Categories
- All Categories
- 2.5K AMX General Discussion
- 922 AMX Technical Discussion
- 514 AMX Hardware
- 502 AMX Control Products
- 3 AMX Video Distribution Products
- 9 AMX Networked AV (SVSI) Products
- AMX Workspace & Collaboration Products
- 3.4K AMX Software
- 151 AMX Resource Management Suite Software
- 386 AMX Design Tools
- 2.4K NetLinx Studio
- 135 Duet/Cafe Duet
- 248 NetLinx Modules & Duet Modules
- 57 AMX RPM Forum
- 228 MODPEDIA - The Public Repository of Modules for Everyone
- 943 AMX Specialty Forums
- 2.6K AMXForums Archive
- 2.6K AMXForums Archive Threads
- 1.5K AMX Hardware
- 432 AMX Applications and Solutions
- 249 Residential Forum
- 182 Tips and Tricks
- 146 AMX Website/Forums