View Single Post
  #9  
Old 01-24-2019, 11:48 AM
BjoernH BjoernH is offline
Registered User
 
Join Date: Mar 2018
Posts: 55
Quote:
Originally Posted by ekoranyi View Post
BjoernH,

I may have gotten a bit ahead of myself, perhaps there is a way to add the sleeps directly into your array.

This might look something like:
Code:
Dim arrStartStandalone(49)
    arrStartStandalone(0) = "192.168.210.140"
    arrStartStandalone(1) = "192.168.210.141"
    arrStartStandalone(2) = "192.168.210.142"
' Need some time for the priors to start up
' before we move on to the next group.
' 5 minutes should be good enough:
    arrStartStandalone(3) = "crt.Sleep 60 * 5 * 1000"
    arrStartStandalone(4) = "192.168.210.5"
    arrStartStandalone(5) = "192.168.210.6"
' The next set needs 7 minutes instead of 5:
    arrStartStandalone(6) = "crt.Sleep 60 * 7 * 1000"
    arrStartStandalone(7) = "192.168.210.201"
    arrStartStandalone(8) = "192.168.210.202"
' .
' .
' .
You could then use the If statement to check if the array entry contains sleep and take the appropriate action.

Code:
For Each strHost in vHosts
    If Instr(strHost, "crt.Sleep") Then
        ' Execute the sleep statement contained in this array entry
        Eval(strHost)
    Else
        ' Do the work of connecting, etc...
    End If
Next
Does this provide the needed functionality?
Thanks Eric, I'll try that. In the meantime I was messing with this, but it barfed.

Code:
'ssh to VMs
	For Each strHosts In Eval(vHost)
    If strHosts = "" Then Exit For

	If doWhat = "start" Then
		If strHosts = "192.168.210.[5, 20] Then 
			crt.Sleep 100000
        End If

    crt.Screen.Send"ssh -q " & strHosts & vbCr

Bjoern
Reply With Quote