def main(): parser = argparse.ArgumentParser() parser.add_argument("-c", "--colors", help="add colors to shell", nargs=1) parser.add_argument("-f", "--file", help="add configuration file", nargs=1) args = parser.parse_args() fd = None if (args.file != None): fd = check_fileExistance(args.file[0]) if (fd is not None): global progs progs = ProgramList(fd) progs.launch() print "BEGIN TASKMASTER" logger.log("BEGIN TASKMASTER") signal.signal(signal.SIGINT, signal_handler) if os.path.exists(historyPath): readline.read_history_file(historyPath) global progs_lock progs_lock = threading.Lock() # launch a thread to test progs t = threading.Thread(target = thread_check_progs) t.daemon = True t.start() shell(progs, args.colors)
def main(): parser = argparse.ArgumentParser() parser.add_argument("-c", "--colors", help="add colors to shell", nargs=1) parser.add_argument("-f", "--file", help="add configuration file", nargs=1) args = parser.parse_args() fd = None if (args.file != None): fd = check_fileExistance(args.file[0]) if (fd is not None): global progs progs = ProgramList(fd) progs.launch() print "BEGIN TASKMASTER" logger.log("BEGIN TASKMASTER") signal.signal(signal.SIGINT, signal_handler) if os.path.exists(historyPath): readline.read_history_file(historyPath) global progs_lock progs_lock = threading.Lock() # launch a thread to test progs t = threading.Thread(target=thread_check_progs) t.daemon = True t.start() shell(progs, args.colors)
def loadNewConfig(progs, file_name): logger.log("loading file") print "loading file" if os.access(file_name, os.R_OK): fd = open(file_name, 'r') else: print("File can't be opened") logger.log("File can't be opened") return if progs is not None: progs.kill_all() progs = ProgramList(fd) progs.launch() return progs