#!/usr/bin/python ''' Created on July 4, 2014 @author: Hovanes Egiyan ''' import os, sys from iocPortMap import * def iocConsole( host, port ) : """ Function to reboot IOC with IOC name """ """ Telnets to the procServ on localhost and type CtrlX to restart the IOC process """ # Username is hdops, it is supposed to be able to login without password username = "hdops" telnetCommand = 'ssh {0}@{1}'.format( username, host ) procServCommand = 'xterm -e "telnet localhost {0}"'.format( port ) command = telnetCommand + " '" + procServCommand + "'" # print 'Will execute command <{0}>'.format( command ) os.system( command ); return if __name__ == '__main__': args = sys.argv[1:] # Make sure only one command line argument exists" if( len(args) != 1 ) : raise Exception("Need one and only one string argument to specify the IOC") iocName = args[0] # print "IOC name is {0}".format( iocName ) host = hostPortMap[iocName]["host"] port = hostPortMap[iocName]["port"] # print "Host is {0}, port number is {1}".format(host, port) iocConsole(host, port)