def action_log_conf(params): """生成process对应log配置文件""" File.make_dirs(params['log_dir']) server = params['server'] for process in server['process']: log_key = process['log_key'] bi_log = os.path.join(params['log_dir'], 'bi-%s.log' % log_key) common_log = os.path.join(params['log_dir'], '%s.log' % log_key) process['bi_log_file'] = bi_log process['log_file'] = common_log
def action_copy_file(params, *dirs): cmds = [] for d in dirs: from_dir = os.path.join(params['src_dir'], d) up_dir = os.path.dirname(from_dir) File.make_dirs(up_dir) cmd = 'cd %s; tar -cf - %s --exclude=*.pyc --exclude=*.c | tar -xf - -C %s' % (up_dir, d, params['bin_dir']) cmds.append(cmd) File.make_dirs(params['bin_dir']) for cmd in cmds: Log.log(cmd) status, output = commands.getstatusoutput(cmd) if status: Log.log(output) return status