python批量启动关闭程序,,#!/usr/bin


#!/usr/bin/env python#coding:utf-8import osimport reimport sysscript_name = sys.argv[0] game_gen_path = ‘/data/bz-tw-and‘def callable(input_args): for (root,dirs,filename) in os.walk(game_gen_path): for file in filename: if re.match(input_args,file): script_abs_path=os.path.join(root,file) os.system(‘sh %s‘ % script_abs_path) if re.match(input_args,‘status‘): os.system(‘ps aux | grep bz-tw-and-s | grep -v grep‘)try: input_args = sys.argv[1]except IndexError as e: print(e) print(‘Example: python %s start|stop|status‘ % script_name )else: callable(input_args)

python批量启动关闭程序

评论关闭