restarting multiple instances of apache - newbie Q

mikeisgreat at gmail.com mikeisgreat at gmail.com
Sat Jun 3 14:05:23 EDT 2006


hi all,

i am new to python programming, so thanks for your patience in advance.

I have a small script that I am working on that i want to restart
multiple instances of apaches on our developers servers. We have about
25 developers each with their own apache.

<snip>
import sys, os

try:
   file = open("users.dat", "r")
except IOError, message:
   print >> sys.stderr, "File could not be opened:", message
   sys.exit( 1 )

fdata = file.xreadlines()

for data in fdata:
   fields = data.split("_")
#   print "USER: " + fields[0] + " ADDRESS: " + fields[1].strip("\n")
    print '/etc/init.d/httpd_' + fields[0] + ' restart

</snip>

each users apache is named 'httpd_{user}'

I am not sure how to do this cleanly other than in a shell script.

I want to restart the apache and wait until complete to restart the
next users apache.

Any advice is appreciated .. 

again, thanks for your time.
-mike




More information about the Python-list mailing list