def start(): parser = argparse.ArgumentParser(description='An daemon used for make a task in a server.The results are saved in a sql database') parser.add_argument('--task', help='The task to execute', required=True) parser.add_argument('--id', help='The id of server where the task must be done', required=True) parser.add_argument('--uuid', help='The uuid for identify this process in database', required=True) info={} args = parser.parse_args() servertask=servers.ServerTask() servertask.create_forms() server=servers.Server() pid=getpid() #servertask.conditions=['where id=%s', [args.id]] arr_server=server.select_a_row(args.id) if arr_server==False: info={'ERROR': 1, 'CODE_ERROR': 4, 'TXT_ERROR': 'Error: server not exists', 'STATUS':1, 'PROGRESS': 100} servertask.insert({'task': args.task, 'uuid': args.uuid, 'status': 1, 'error': 1, 'pid': pid, 'info': json.dumps(info)}) exit(1) arr_server['ip']=arr_server.get('ip', '') if arr_server['ip']=='': info={'ERROR': 1, 'CODE_ERROR': 2, 'TXT_ERROR': 'Error: server not exists', 'STATUS':1, 'PROGRESS': 100} servertask.insert({'task': args.task, 'uuid': args.uuid, 'status': 1, 'error': 1, 'pid': pid, 'info': json.dumps(info)}) exit(1) ip=arr_server['ip'] try: server=str(ipaddress.ip_address(ip)) except: info={'ERROR': 1, 'CODE_ERROR': 1, 'TXT_ERROR': 'Error: ip not valid', 'STATUS':1, 'PROGRESS': 100} servertask.insert({'task': args.task, 'uuid': args.uuid, 'status': 1, 'error': 1, 'pid': pid, 'info': json.dumps(info)}) exit(1) # Prepare basic configuration home=getenv("HOME") if ConfigClass.public_key=='': ConfigClass.public_key=home+'/.ssh/id_rsa.pub' if ConfigClass.private_key=='': ConfigClass.private_key=home+'/.ssh/id_rsa' # Prepare task task_name=path.basename(args.task) task=args.task.replace('.','_') task=args.task.replace('/','.') #Seeking task path for p in ConfigClass.tasks_path: task_path=p+'.'+task+'.config' task_path_route=task_path.replace('.','/')+'.py' #tpath=Path(task_path_route) if path.isfile(task_path_route): break try: config_task=import_module(task_path) except SyntaxError as e: info={'ERROR': 1, 'CODE_ERROR': 1, 'TXT_ERROR': 'Error: error in task: '+str(e), 'STATUS':1, 'PROGRESS': 100} servertask.insert({'task': args.task, 'uuid': args.uuid, 'status': 1, 'error': 3, 'pid': pid, 'info': json.dumps(info)}) exit(1) except: info={'ERROR': 1, 'CODE_ERROR': 1, 'TXT_ERROR': 'Error: error in task: '+traceback.format_exc(), 'STATUS':1, 'PROGRESS': 100} servertask.insert({'task': args.task, 'uuid': args.uuid, 'status': 1, 'error': 3, 'info': json.dumps(info)}) exit(1) # Load locals # Prepare ssh connection ssh = paramiko.SSHClient() ssh.load_system_host_keys() #Check if the unknown host keys are rejected or not if ConfigClass.deny_missing_host_key == False: ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) #Prepare ssh keys rsa=prepare_ssh_keys(ConfigClass.password_key) if rsa==None: exit(1) try: ssh.connect(server, port=ConfigClass.port, username=ConfigClass.remote_user, password=None, pkey=rsa, key_filename=ConfigClass.private_key, timeout=None, allow_agent=True, look_for_keys=True, compress=False, sock=None, gss_auth=False, gss_kex=False, gss_deleg_creds=True, gss_host=None, banner_timeout=None) except paramiko.SSHException as e: info={'ERROR': 1, 'CODE_ERROR': 1, 'TXT_ERROR': 'Error: Cannot connect: '+str(e), 'STATUS':1, 'PROGRESS': 100} servertask.insert({'task': args.task, 'uuid': args.uuid, 'status': 1, 'error': 1, 'pid': pid, 'info': json.dumps(info)}) exit(1) except paramiko.AuthenticationException as e: info={'ERROR': 1, 'CODE_ERROR': 1, 'TXT_ERROR': 'Error: Cannot connect: '+str(e), 'STATUS':1, 'PROGRESS': 100} servertask.insert({'task': args.task, 'uuid': args.uuid, 'status': 1, 'error': 1, 'pid': pid, 'info': json.dumps(info)}) exit(1) except paramiko.BadHostKeyException as e: info={'ERROR': 1, 'CODE_ERROR': 1, 'TXT_ERROR': 'Error: Cannot connect: '+str(e), 'STATUS':1, 'PROGRESS': 100} servertask.insert({'task': args.task, 'uuid': args.uuid, 'status': 1, 'error': 1, 'pid': pid, 'info': json.dumps(info)}) exit(1) except OSError as e: info={'ERROR': 1, 'CODE_ERROR': 1, 'TXT_ERROR': 'Error: Cannot connect: '+str(e), 'STATUS':1, 'PROGRESS': 100} servertask.insert({'task': args.task, 'uuid': args.uuid, 'status': 1, 'error': 1, 'pid': pid, 'info': json.dumps(info)}) exit(1) except: info={'ERROR': 1, 'CODE_ERROR': 1, 'TXT_ERROR': 'Error: Cannot connect: '+traceback.format_exc(), 'STATUS':1, 'PROGRESS': 100} servertask.insert({'task': args.task, 'uuid': args.uuid, 'status': 1, 'error': 1, 'pid': pid, 'info': json.dumps(info)}) exit(1) # Check that exists the script in server if len(ConfigTask.action)==0: logging.warning('Error, check your task. The number of actions in task is zero') exit(1) # TODO Add external config for this task for action in ConfigTask.action: # Check if exists the files path_file='protozoo/scripts/'+arr_server['os_codename']+'/'+action.script_path stdin, stdout, stderr = ssh.exec_command('if [ ! -f "'+path_file+'" ] ; then false ; fi') if stdout.channel.recv_exit_status()>0: # Uploading the files first time if not exists # TODO Use md5 hash for check the file. # print('File '+path_file+' doesn\'t exists') # Upload the script of this task try: stdin, stdout, stderr = ssh.exec_command('mkdir -p '+path.dirname(path_file)) sftp=ssh.open_sftp() sftp.put(path_file, path_file) # TODO Upload extra files except: info={'ERROR': 1, 'CODE_ERROR': 5, 'TXT_ERROR': 'Error: Cannot connect: '+traceback.format_exc(), 'STATUS':1, 'PROGRESS': 100} servertask.insert({'task': args.task, 'uuid': args.uuid, 'status': 1, 'pid': pid, 'error': 1, 'info': json.dumps(info)}) exit(1) # Obtain the script command action.script_interpreter='' file_line=open(path_file) execute_line=file_line.readline() file_line.close() if execute_line.find("#!")==0: action.script_interpreter=execute_line.replace('#!', '').strip()+' ' #Execute the script command_to_execute=action.script_interpreter+path_file+" "+action.parameters try: #, get_pty=True stdin, stdout, stderr = ssh.exec_command(command_to_execute) for line in stdout: servertask.insert({'task': args.task, 'uuid': args.uuid, 'status': 1, 'pid': pid, 'error': 1, 'info': line}) for line in stderr: #logging.warning(action.codename+" WARNING: "+line) pass if stdout.channel.recv_exit_status()>0: #line=stdout.readlines() #logging.warning(action.codename+" WARNING: "+line) info={'ERROR': 1, 'CODE_ERROR': 6, 'TXT_ERROR': 'Error: The script '+action.codename+' show an error: '+traceback.format_exc(), 'STATUS':1, 'PROGRESS': 100} servertask.insert({'task': args.task, 'uuid': args.uuid, 'status': 1, 'pid': pid, 'error': 1, 'info': json.dumps(info)}) exit(1) except: info={'ERROR': 1, 'CODE_ERROR': 6, 'TXT_ERROR': 'Error: The script show an error: '+traceback.format_exc(), 'STATUS':1, 'PROGRESS': 100} servertask.insert({'task': args.task, 'uuid': args.uuid, 'status': 1, 'pid': pid, 'error': 1, 'info': json.dumps(info)}) exit(1) ssh.close()
def start(): parser = argparse.ArgumentParser( description= 'An daemon used for make a task in a server.The results are saved in a sql database' ) parser.add_argument('--task', help='The task to execute', required=True) parser.add_argument('--id', help='The id of server where the task must be done', required=True) parser.add_argument('--uuid', help='The uuid for identify this process in database', required=True) info = {} args = parser.parse_args() servertask = servers.ServerTask() servertask.create_forms() server = servers.Server() pid = getpid() #servertask.conditions=['where id=%s', [args.id]] arr_server = server.select_a_row(args.id) if arr_server == False: info = { 'ERROR': 1, 'CODE_ERROR': 4, 'TXT_ERROR': 'Error: server not exists', 'STATUS': 1, 'PROGRESS': 100 } servertask.insert({ 'task': args.task, 'uuid': args.uuid, 'status': 1, 'error': 1, 'pid': pid, 'info': json.dumps(info) }) exit(1) arr_server['ip'] = arr_server.get('ip', '') if arr_server['ip'] == '': info = { 'ERROR': 1, 'CODE_ERROR': 2, 'TXT_ERROR': 'Error: server not exists', 'STATUS': 1, 'PROGRESS': 100 } servertask.insert({ 'task': args.task, 'uuid': args.uuid, 'status': 1, 'error': 1, 'pid': pid, 'info': json.dumps(info) }) exit(1) ip = arr_server['ip'] try: server = str(ipaddress.ip_address(ip)) except: info = { 'ERROR': 1, 'CODE_ERROR': 1, 'TXT_ERROR': 'Error: ip not valid', 'STATUS': 1, 'PROGRESS': 100 } servertask.insert({ 'task': args.task, 'uuid': args.uuid, 'status': 1, 'error': 1, 'pid': pid, 'info': json.dumps(info) }) exit(1) # Prepare basic configuration home = getenv("HOME") if ConfigClass.public_key == '': ConfigClass.public_key = home + '/.ssh/id_rsa.pub' if ConfigClass.private_key == '': ConfigClass.private_key = home + '/.ssh/id_rsa' # Prepare task task_name = path.basename(args.task) task = args.task.replace('.', '_') task = args.task.replace('/', '.') #Seeking task path for p in ConfigClass.tasks_path: task_path = p + '.' + task + '.config' task_path_route = task_path.replace('.', '/') + '.py' #tpath=Path(task_path_route) if path.isfile(task_path_route): break try: config_task = import_module(task_path) except SyntaxError as e: info = { 'ERROR': 1, 'CODE_ERROR': 1, 'TXT_ERROR': 'Error: error in task: ' + str(e), 'STATUS': 1, 'PROGRESS': 100 } servertask.insert({ 'task': args.task, 'uuid': args.uuid, 'status': 1, 'error': 3, 'pid': pid, 'info': json.dumps(info) }) exit(1) except: info = { 'ERROR': 1, 'CODE_ERROR': 1, 'TXT_ERROR': 'Error: error in task: ' + traceback.format_exc(), 'STATUS': 1, 'PROGRESS': 100 } servertask.insert({ 'task': args.task, 'uuid': args.uuid, 'status': 1, 'error': 3, 'info': json.dumps(info) }) exit(1) # Load locals # Prepare ssh connection ssh = paramiko.SSHClient() ssh.load_system_host_keys() #Check if the unknown host keys are rejected or not if ConfigClass.deny_missing_host_key == False: ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) #Prepare ssh keys rsa = prepare_ssh_keys(ConfigClass.password_key) if rsa == None: exit(1) try: ssh.connect(server, port=ConfigClass.port, username=ConfigClass.remote_user, password=None, pkey=rsa, key_filename=ConfigClass.private_key, timeout=None, allow_agent=True, look_for_keys=True, compress=False, sock=None, gss_auth=False, gss_kex=False, gss_deleg_creds=True, gss_host=None, banner_timeout=None) except paramiko.SSHException as e: info = { 'ERROR': 1, 'CODE_ERROR': 1, 'TXT_ERROR': 'Error: Cannot connect: ' + str(e), 'STATUS': 1, 'PROGRESS': 100 } servertask.insert({ 'task': args.task, 'uuid': args.uuid, 'status': 1, 'error': 1, 'pid': pid, 'info': json.dumps(info) }) exit(1) except paramiko.AuthenticationException as e: info = { 'ERROR': 1, 'CODE_ERROR': 1, 'TXT_ERROR': 'Error: Cannot connect: ' + str(e), 'STATUS': 1, 'PROGRESS': 100 } servertask.insert({ 'task': args.task, 'uuid': args.uuid, 'status': 1, 'error': 1, 'pid': pid, 'info': json.dumps(info) }) exit(1) except paramiko.BadHostKeyException as e: info = { 'ERROR': 1, 'CODE_ERROR': 1, 'TXT_ERROR': 'Error: Cannot connect: ' + str(e), 'STATUS': 1, 'PROGRESS': 100 } servertask.insert({ 'task': args.task, 'uuid': args.uuid, 'status': 1, 'error': 1, 'pid': pid, 'info': json.dumps(info) }) exit(1) except OSError as e: info = { 'ERROR': 1, 'CODE_ERROR': 1, 'TXT_ERROR': 'Error: Cannot connect: ' + str(e), 'STATUS': 1, 'PROGRESS': 100 } servertask.insert({ 'task': args.task, 'uuid': args.uuid, 'status': 1, 'error': 1, 'pid': pid, 'info': json.dumps(info) }) exit(1) except: info = { 'ERROR': 1, 'CODE_ERROR': 1, 'TXT_ERROR': 'Error: Cannot connect: ' + traceback.format_exc(), 'STATUS': 1, 'PROGRESS': 100 } servertask.insert({ 'task': args.task, 'uuid': args.uuid, 'status': 1, 'error': 1, 'pid': pid, 'info': json.dumps(info) }) exit(1) # Check that exists the script in server if len(ConfigTask.action) == 0: logging.warning( 'Error, check your task. The number of actions in task is zero') exit(1) # TODO Add external config for this task for action in ConfigTask.action: # Check if exists the files path_file = 'protozoo/scripts/' + arr_server[ 'os_codename'] + '/' + action.script_path stdin, stdout, stderr = ssh.exec_command('if [ ! -f "' + path_file + '" ] ; then false ; fi') if stdout.channel.recv_exit_status() > 0: # Uploading the files first time if not exists # TODO Use md5 hash for check the file. # print('File '+path_file+' doesn\'t exists') # Upload the script of this task try: stdin, stdout, stderr = ssh.exec_command( 'mkdir -p ' + path.dirname(path_file)) sftp = ssh.open_sftp() sftp.put(path_file, path_file) # TODO Upload extra files except: info = { 'ERROR': 1, 'CODE_ERROR': 5, 'TXT_ERROR': 'Error: Cannot connect: ' + traceback.format_exc(), 'STATUS': 1, 'PROGRESS': 100 } servertask.insert({ 'task': args.task, 'uuid': args.uuid, 'status': 1, 'pid': pid, 'error': 1, 'info': json.dumps(info) }) exit(1) # Obtain the script command action.script_interpreter = '' file_line = open(path_file) execute_line = file_line.readline() file_line.close() if execute_line.find("#!") == 0: action.script_interpreter = execute_line.replace('#!', '').strip() + ' ' #Execute the script command_to_execute = action.script_interpreter + path_file + " " + action.parameters try: #, get_pty=True stdin, stdout, stderr = ssh.exec_command(command_to_execute) for line in stdout: servertask.insert({ 'task': args.task, 'uuid': args.uuid, 'status': 1, 'pid': pid, 'error': 1, 'info': line }) for line in stderr: #logging.warning(action.codename+" WARNING: "+line) pass if stdout.channel.recv_exit_status() > 0: #line=stdout.readlines() #logging.warning(action.codename+" WARNING: "+line) info = { 'ERROR': 1, 'CODE_ERROR': 6, 'TXT_ERROR': 'Error: The script ' + action.codename + ' show an error: ' + traceback.format_exc(), 'STATUS': 1, 'PROGRESS': 100 } servertask.insert({ 'task': args.task, 'uuid': args.uuid, 'status': 1, 'pid': pid, 'error': 1, 'info': json.dumps(info) }) exit(1) except: info = { 'ERROR': 1, 'CODE_ERROR': 6, 'TXT_ERROR': 'Error: The script show an error: ' + traceback.format_exc(), 'STATUS': 1, 'PROGRESS': 100 } servertask.insert({ 'task': args.task, 'uuid': args.uuid, 'status': 1, 'pid': pid, 'error': 1, 'info': json.dumps(info) }) exit(1) ssh.close()
def start(): pyv = python_version_tuple() if pyv[0] != '3': print('Need python 3 for execute this script') sys.exit(1) parser = argparse.ArgumentParser( description= 'An IT tool for make tasks in servers. Is used for Pastafari for add new modules to the servers and others tasks' ) parser.add_argument('--task', help='The task to execute', required=True) parser.add_argument('--profile', help='The profile used for make tasks', required=False) #parser.add_argument('--resume', help='If error, begin the tasks in the server where the fail ', required=False, nargs='?', const='1') #parser.add_argument('--json', help='Save the progress in an file in json format', required=False, nargs='?', const='1') #parser.add_argument('--daemon', help='Daemonize the process, send an email when finish', required=False, nargs='?', const='1') args = parser.parse_args() home = os.getenv("HOME") #Init colored terminal init(autoreset=True) #Prepare variables if args.profile == None: args.profile = 'servers' #Prepare routes for scripts and logs #ConfigClass.scripts_path=['scripts', 'protozoo/scripts'] ConfigClass.logs_path = 'logs' ConfigClass.public_key = home + '/.ssh/id_rsa.pub' ConfigClass.private_key = home + '/.ssh/id_rsa' ConfigClass.password_key = None task_name = os.path.basename(args.task) task = args.task.replace('.', '_') task = args.task.replace('/', '.') # Load Profile, you can put custom configclass configs in it try: profile = import_module('settings.' + args.profile) except ImportError as e: print("Error, cannot find " + args.profile + " profile: " + str(e)) exit(1) #Seeking task path for p in ConfigClass.tasks_path: task_path = p + '.' + task + '.config' task_path_route = task_path.replace('.', '/') + '.py' #tpath=Path(task_path_route) if os.path.isfile(task_path_route): break # Load config for the task try: config_task = import_module(task_path) except SyntaxError as e: print("Error: " + str(e)) exit(1) except: print("Error: cannot load the task, exists " + task_path + " file?") e = sys.exc_info()[0] v = sys.exc_info()[1] print("Error: %s %s" % (e, v)) exit(1) # Load settings.py try: config = import_module('settings.config') except SyntaxError as e: print("Error: " + str(e)) exit(1) except: pass #Check logs folder create_dir(ConfigClass.logs_path) #Prepare sftp and ssh client = paramiko.SSHClient() client.load_system_host_keys() #Check if the unknown host keys are rejected or not if ConfigClass.deny_missing_host_key == False: client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) #Prepare ssh keys rsa = prepare_ssh_keys(ConfigClass.password_key) if rsa == None: exit(1) #Make a trial with tmp path in remote server. Need this check because i don't want delete neccesary files from the server. delete_tmp_files = ConfigClass.remote_path + '/' + ConfigClass.tmp_sftp_path + '/*' if delete_tmp_files == "//*": print("Error: your remote paths are bad defined") exit(1) # Iterate profile. #for (server, features) in profile.servers.items() num_forks = 0 p_server = OrderedDict() if __name__ == 'protozoo.main': ConfigClass.num_servers = len(profile.servers) c_servers = round(100 / ConfigClass.num_servers) p_count = 0 #Open file where save servers failed and last server executed fine. file_resume = open(".resume.py", "w+") print(Fore.WHITE + Style.BRIGHT + "Welcome to Protozoo!!") print(Fore.YELLOW + "Executing task <" + task_name + "> in " + str(ConfigClass.num_servers) + " machines") print(Fore.WHITE + Style.BRIGHT + ConfigTask.info) show_progress(p_count) for features in profile.servers: p_server[features['hostname']] = Process(target=make_task, args=(rsa, client, task_name, features, args.task)) p_server[features['hostname']].start() #p_server[features['hostname']].join() num_forks += 1 #Check forks if error or stop, if stop num_forks-=1 and clean dictionary #If error, wait to the all process finish #Make checking if num_forks >= ConfigClass.num_of_forks: p_server, num_forks, p_count = check_process( p_server, num_forks, True, p_count, c_servers) p_server, num_forks, p_count = check_process(p_server, num_forks, False, p_count, c_servers) print(Fore.YELLOW + Style.BRIGHT + "Results: success:" + str(ConfigClass.num_success) + ', fails:' + str(ConfigClass.num_errors)) print(Style.BRIGHT + "All tasks executed")
def start(): pyv=python_version_tuple() if pyv[0]!='3': print('Need python 3 for execute this script') sys.exit(1) parser = argparse.ArgumentParser(description='An IT tool for make tasks in servers. Is used for Pastafari for add new modules to the servers and others tasks') parser.add_argument('--task', help='The task to execute', required=True) parser.add_argument('--profile', help='The profile used for make tasks', required=False) #parser.add_argument('--resume', help='If error, begin the tasks in the server where the fail ', required=False, nargs='?', const='1') #parser.add_argument('--json', help='Save the progress in an file in json format', required=False, nargs='?', const='1') #parser.add_argument('--daemon', help='Daemonize the process, send an email when finish', required=False, nargs='?', const='1') args = parser.parse_args() home=os.getenv("HOME") #Init colored terminal init(autoreset=True) #Prepare variables if args.profile == None: args.profile='servers' #Prepare routes for scripts and logs #ConfigClass.scripts_path=['scripts', 'protozoo/scripts'] ConfigClass.logs_path='logs' ConfigClass.public_key=home+'/.ssh/id_rsa.pub' ConfigClass.private_key=home+'/.ssh/id_rsa' ConfigClass.password_key=None task_name=os.path.basename(args.task) task=args.task.replace('.','_') task=args.task.replace('/','.') # Load Profile, you can put custom configclass configs in it try: profile=import_module('settings.'+args.profile) except ImportError as e: print("Error, cannot find "+args.profile+" profile: "+str(e)) exit(1) #Seeking task path for p in ConfigClass.tasks_path: task_path=p+'.'+task+'.config' task_path_route=task_path.replace('.','/')+'.py' #tpath=Path(task_path_route) if os.path.isfile(task_path_route): break # Load config for the task try: config_task=import_module(task_path) except SyntaxError as e: print("Error: "+str(e)) exit(1) except: print("Error: cannot load the task, exists "+task_path+" file?") e = sys.exc_info()[0] v = sys.exc_info()[1] print("Error: %s %s" % (e, v)) exit(1) # Load settings.py try: config=import_module('settings.config') except SyntaxError as e: print("Error: "+str(e)) exit(1) except: pass #Check logs folder create_dir(ConfigClass.logs_path) #Prepare sftp and ssh client = paramiko.SSHClient() client.load_system_host_keys() #Check if the unknown host keys are rejected or not if ConfigClass.deny_missing_host_key == False: client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) #Prepare ssh keys rsa=prepare_ssh_keys(ConfigClass.password_key) if rsa==None: exit(1) #Make a trial with tmp path in remote server. Need this check because i don't want delete neccesary files from the server. delete_tmp_files=ConfigClass.remote_path+'/'+ConfigClass.tmp_sftp_path+'/*' if delete_tmp_files == "//*": print("Error: your remote paths are bad defined") exit(1) # Iterate profile. #for (server, features) in profile.servers.items() num_forks=0 p_server=OrderedDict() if __name__ == 'protozoo.main': ConfigClass.num_servers=len(profile.servers) c_servers=round(100/ConfigClass.num_servers) p_count=0 #Open file where save servers failed and last server executed fine. file_resume=open(".resume.py", "w+") print(Fore.WHITE+Style.BRIGHT +"Welcome to Protozoo!!") print(Fore.YELLOW +"Executing task <"+task_name+"> in "+str(ConfigClass.num_servers)+" machines") print(Fore.WHITE+Style.BRIGHT +ConfigTask.info) show_progress(p_count) for features in profile.servers: p_server[features['hostname']] = Process(target=make_task, args=(rsa, client, task_name, features, args.task)) p_server[features['hostname']].start() #p_server[features['hostname']].join() num_forks+=1 #Check forks if error or stop, if stop num_forks-=1 and clean dictionary #If error, wait to the all process finish #Make checking if num_forks >= ConfigClass.num_of_forks: p_server, num_forks, p_count=check_process(p_server, num_forks, True, p_count, c_servers) p_server, num_forks, p_count=check_process(p_server, num_forks, False, p_count, c_servers) print(Fore.YELLOW+Style.BRIGHT +"Results: success:"+str(ConfigClass.num_success)+', fails:'+str(ConfigClass.num_errors)) print(Style.BRIGHT +"All tasks executed")