Hello...thanks to several individuals, I've been able to get a little
farther in this Opsware global shell script:

#!/usr/bin/python
import os
outfile = open('test.txt','w')
for servername in os.listdir('/opsw/Server/@'):
    print '---', servername
    print >> outfile, '---', servername
    rosh = 'rosh -n %s -l $LOGNAME \ date' % (servername)
    os.system(rosh)
outfile.close()

This does most of what I need, but I've run into two issues.

1) After it uses the rosh command to remotely access a managed system, it
executes the "date" command...but I need to be able to direct the date
output to the outfile. I imagine it's probably going to be similar to how it
directs output of the servernames, but still not quite sure how this fits in
the scheme of this command.

2) Some connection attempts to systems just hang...not really sure why
(yet), but I'd like to be able to specify some kind of timeout so that it
executes the rosh command, and if it doesn't connect in 10 seconds, breaks
the connection, and moves on to the next server in the list. I've read that
there is some kind of a built-in timeout function, but I'm quite stumped on
this one.

If anyone has any suggestions or pointers, I'd really appreciate it. Thanks
very much!

K
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to