- tms-old
- tms
- config
- tmsRestart
This file ( 2kB ) exceeds the allowed full mode (48 kb) size.
The editor full hight is disabled, only scrolling is allowed..
If you wish to edit a file, it is recommended to use the scroll mode as some users do not like the full height
mode, although some users like it.
#!/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");
time.sleep(1);
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("systemctl restart boapns-tms");
# Restart Main server
print "Restart tmsServers";
s = os.system("systemctl restart tmsServer@1");
if(os.path.exists("/etc/tmsServer2.conf")):
s = os.system("systemctl restart tmsServer@2");
if(os.path.exists("/etc/tmsServer3.conf")):
s = os.system("systemctl restart tmsServer@3");
if(os.path.exists("/etc/tmsServer4.conf")):
s = os.system("systemctl restart tmsServer@4");
print "Restart tmsWeb";
s = os.system("systemctl restart tmsWeb");
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();