While I was able to complete the job, it took me much longer that I expected and I want to bring to Tera Term project team's attention the issues that I experienced and had to troubleshoot as well as few observations:
- Since the task supposed to take quite some time, my intention was to start it and continue working on something else. Unfortunately I was not able to accomplish this because every time SSH Authentication window popups up, it steals the focus from active application, i.e. I was not able to write emails and do other work. Neither setting showtt 0, nor minimizing Tera Term window changes this annoying behavior.
- If SSH login fails due to incorrect credentials testlink command is not able to identify it. The macro goes into waiting loop and there is no indication of what happened. Only after terminating the macro and closing Tera Term main window the error message appears saying that user credentials were invalid. I expect the same will happen if authentication method (password, challenge, etc) is incorrect, but I have not tested that. There should be a better way to handle such scenarios.
- After failure to log in as described in the previous item I tried to pause and resume macro. This unexpectedly caused new Tera Term window to open and macro script continued running there. I was logging the session and to continue logging under this behavior I had to move logopen and logclose commands inside the loop.
- /nosecurity argument of connect command (which is by the way not documented in Help) suppresses the warning popup, however it does not add the signature to ssh_known_hosts file. Not sure if this is a bug or as per design. In either case this is not the behavior user may expect.
- There was number of times when the 1st sendln command after establishing the connection would not appear on the screen and in the log file, nevertheless it was preceded by wait for prompt command. Considering that I was not able to do anything else due to the 1st issue in this list and that I used setsync command in my macro, it would be interesting to know if I reached the capacity limits of the application.
Here is my Macro script:
Code: Select all
- timeout = 2
- Logfile = 'C:\Temp\logfile.txt' ; log file name
- fileopen fhandle 'C:\Temp\ip_addresses.txt' 0 ; plain text file with one hostname (or IP) per line
- while 1
- filereadln fhandle ip_address
- if result=1 then
- sprintf2 con_str '%s:22 /ssh /2 /nosecuritywarning /auth=password /user=username /passwd=thepassword' ip_address
- connect con_str
- if result = 2 then
- setsync 1
- logopen Logfile 0 1 0 0
- wait '#'
- sendln 'show version'
- wait '#'
- sendln 'show config-sync'
- wait '#'
- disconnect 0
- pause 1
- loop while result = 2
- messagebox "Cannot connect to the host. Click OK to Continue." "Connection Error"
- fileclose fhandle
I am running Tera Term 4.93 on Windows 7 Professional.