Resume commands on connection? [2]

Resume commands on connection?

Friday, August 23, 2013 3:30 PM - Rednroll

I'm currently using Xshell to console into a host via serial connection.

I really enjoy the quick commands function in this console and have been writing multiple TXT files which issue commonly used commands

However, today I ran into a problem in writing one of these TXT files and I'm not sure how to get around it. I'm starting to think that maybe I should be writing a script instead but not sure if that would accomplish what I'm trying to do either.

So what I'm trying to do is perform a software update process on my host device. Part of this process involves me sending 2 console commands to write some information to the device, then I need to reset the device. The reset obviously causes me to temporarily lose connection with the device.

However, when the device finishes rebooting, connection is automatically re-established. At that point I would like the commands in the TXT to finish executing, but it doesn't because the connection was lost temporarily.

Example:
#update_IFS
#reset
#sleep 60 (takes approx. 60 seconds for a reboot)
(device reboots)

(next I get prompted for a login/pass but TXT file does not continue running after reset)
#
#login
#pass
#./fs/etfs/sw_update.sh

Can this be completed if I write a VBS script instead? Is there anyway to have the commands continue to be executed even though the connection was temporarily lost?

Program Ver. : Xshell 4


Re: Resume commands on connection?

Monday, August 26, 2013 12:02 AM - Support

You can do this by using script. Here is how:

1. Use the reconnect option in the session properties. This will let you automatically reconnect to server once it reboots.

2. Use the script file to wait enough time for the machine to reboot and then reconnect. For example, the following script file will wait for 5 sec and then, send text "string test".

Sub Main

xsh.Screen.Synchronous = true

xsh.Screen.Send("last message before going offline")
xsh.Session.Sleep(5000)
xsh.Screen.Send("back online")

xsh.Screen.Synchronous = false

End Sub


---
Technical Support


Re: Resume commands on connection?

Wednesday, August 28, 2013 7:14 AM - Rednroll

Thank you for the reply and additional information. It sounds like it's time to start writing a script. It's good to hear there is a solution.


Previous views: 102