RSS Git Download  Clone
Raw View History
Blames found: 1 Mode: text Binary: false


Hang on, we reloading big blames...
#!/usr/bin/env python ################################################################################ # TmsRestart Restart TMS Daemon's # T.Barnaby, BEAM Ltd, 2007-06-19 ################################################################################ # import os import sys import signal import time import getopt import telnetlib import socket def alarmHandler(signum, frame): raise IOError, "Couldn't connect" def tmsModRestart(hostName): tn = telnetlib.Telnet(); print "Restart tmsPuServer on:", hostName; # Set the signal handler and a 5-second alarm signal.signal(signal.SIGALRM, alarmHandler) signal.alarm(2); try: r = tn.open(hostName); except IOError: print "Timeout while attempting telnet to:", hostName; return 1; except socket.error: print "Timeout error while attempting telnet to:", hostName; return 1; signal.alarm(0) # Disable the alarm r = tn.read_until("login: ", 1); tn.write("root\n"); # Restart TmsPuServer process tn.write("killall -9 tmsPuServer\n"); time.sleep(1); tn.write("/usr/tms/bin/tmsPuServer\n"); tn.write("exit\n"); # tn.write("reboot\n"); # tn.read_all(); return 0; def usage(): print "Usage: tmsRestart"; print " Restarts the TMS daemon processes." def main(): try: opts, args = getopt.getopt(sys.argv[1:], "p:"); except getopt.GetoptError: # print help information and exit: usage(); sys.exit(1); for o in opts: if(o[0] == "-h"): usage(); return 1; else: usage(); return 1; # Restart Boapns server print "Restart boarns"; s = os.system("service boapns restart"); # Restart Main server print "Restart tmsServer"; s = os.system("service tmsServer restart"); print "Restart tmsWeb"; s = os.system("service tmsWeb restart"); time.sleep(2); # Restart module controllers tmsModRestart("tmsmod1.tmsnet"); tmsModRestart("tmsmod2.tmsnet"); tmsModRestart("tmsmod3.tmsnet"); tmsModRestart("tmsmod4.tmsnet"); sys.exit(0); if __name__ == "__main__": main();