首页 > 编程语言 > 详细

python批量启动关闭程序

时间:2018-06-27 11:17:55      阅读:235      评论:0      收藏:0      [点我收藏+]
#!/usr/bin/env python #coding:utf-8 import os import re import sys script_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批量启动关闭程序

原文:http://blog.51cto.com/yht1990/2133082

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!