服务器升级组件的时候可以考虑运行这段python
import socket
import sys
def update(output="system is updating,please wait for a while,thanks",myport=80):
counter=0
myname = socket.getfqdn(socket.gethostname())
myip = socket.gethostbyname(myname)
mysocket=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
try:
mysocket.bind((myip,myport))
except socket.error:
sys.exit("worry")
while 1:
print "wait for a while"
mysocket.listen(1)
connection, address=mysocket.accept()
counter +=1
#print address,counter,"\n"
# t=connection.recv(4096);"\n"
# print t
connection.send(output)
print "over\n"
connection.close()
update()
是指需要关闭apache的时候.. AD :@ :@ :@ :@
页:
[1]