diff --git a/examples/sshd.py b/examples/sshd.py index 27166cb909837a80221e920614b430e559584943..d7f45a4f8f70341e9e6b2567172903f38a2e3cbd 100755 --- a/examples/sshd.py +++ b/examples/sshd.py @@ -59,6 +59,16 @@ def sshd( network, cmd='/usr/sbin/sshd', opts='-D', connectToRootNS( network, switch, ip, routes ) for host in network.hosts: host.cmd( cmd + ' ' + opts + '&' ) + + # wait until each host's sshd has started up + remaining = list( network.hosts ) + while True: + for host in tuple( remaining ): + if 'sshd is running' in host.cmd( 'service ssh status' ): + remaining.remove( host ) + if not remaining: + break + print print "*** Hosts are running sshd at the following addresses:" print