def copy_log(): print '' ml = utils.get_machines() os.system('rm -rf exp_log') for m in ml: os.system('mkdir -p exp_log/%s 2> /dev/null > /dev/null' % m.strip()) cmd_template = 'scp -r %%s:%s/%s/* exp_log/%%s/ 2> /dev/null > /dev/null' % ( FILEPATH, LOG_DIR) cmd_template_for_local = 'cp -r %s/%s/* exp_log/%%s/ 2> /dev/null > /dev/null' % ( FILEPATH, LOG_DIR) for m in ml: if m.startswith(HOSTNAME): cmd = cmd_template_for_local % m else: cmd = cmd_template % (m, m) print 'Copying logs from ' + m os.system(cmd) print cmd if m.startswith(HOSTNAME): os.system('ssh %s \'rm -rf %s/%s/*\'' % (m, FILEPATH, LOG_DIR)) print 'Finished.'
#!/usr/bin/env python import os, sys import commands import time import utils FILEPATH = os.path.dirname(os.path.realpath(__file__)) SERVER_NAME = utils.get_machines_from_file('execs.backend') ORDER_NAME = utils.get_machines_from_file('orders.backend') FILTER_NAME = utils.get_machines_from_file('filters.backend') PROPERTY_FILE = sys.argv[1] all_machines = utils.get_machines() print 'Killing Java processes on needed machines...' for m in all_machines: print 'Killing processes on: ' + m os.system( 'ssh %s \'killall java 2> /dev/null \' > /dev/null 2> /dev/null ' % m) print 'Done machine cleaning.' agent_path = '-agentlib:hprof=cpu=samples,interval=100,depth=10' num_servers = int( commands.getstatusoutput('grep \"EXEC.* =\" %s| wc -l' % PROPERTY_FILE)[1]) num_orders = int( commands.getstatusoutput('grep \"ORDER.* =\" %s| wc -l' % PROPERTY_FILE)[1])
#!/usr/bin/env python import os, sys, commands, threading, time import utils FILEPATH = os.path.dirname(os.path.realpath(__file__)) HOSTNAME = commands.getoutput('hostname') dirs = ['keys', 'lib'] dstuff = '{keys,lib}' files = ['*.properties*', '*.backend', "execs", "verifiers", "filters", "clients"] fstuff = '{*.properties*,*.backend,execs,verifiers,filters}' ml = utils.get_machines() print ("Copying from", str(ml)) os.system("cp ../dist/lib/bft.jar .") os.system('rm lib/bft.jar') os.system('cp bft.jar lib/') def copy_to_machine(machine): cmd_template = 'ssh %s \' mkdir -p %s/%%s \' ' % (machine, FILEPATH) print "Copying to " + machine #print 'ssh %s \' mkdir -p %s\' ' % (machine, FILEPATH) os.system('ssh %s \' mkdir -p %s\' ' % (machine, FILEPATH)) #print 'ssh %s \' mkdir -p %s%s\' ' % (machine, FILEPATH, '/jh_log') os.system('ssh %s \' mkdir -p %s%s\' ' % (machine, FILEPATH, '/jh_log')) #print 'ssh %s \' rm -rf %s%s/*\' ' % (machine, FILEPATH, '/jh_log')