Xshell Forum

Resume commands on connection?

Last post: Wednesday, August 28, 2013 7:14 AM by Rednroll, 2 reply

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

Resume commands on connection?

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.

#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)

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
Monday, August 26, 2013 12:02 AM - Support

Re: Resume commands on connection?

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.Screen.Send("back online")

xsh.Screen.Synchronous = false

End Sub

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

Re: Resume commands on connection?

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.