Commit b555f4dc by zhangwei

增加配置文件

parent 6cbf6f8f
[book]
app_name = "book"
app_dir = "/web/shenlan"
app_log_dir = ""
app_log_filename = ""
app_uid = "www-data"
app_gid = "www-data"
app_suid = "root"
app_sgid = "root"
[cdn]
app_name = "cdn"
app_dir = "/web/shenlan"
app_log_dir = ""
app_log_filename = ""
app_uid = "www-data"
app_gid = "www-data"
app_suid = "root"
app_sgid = "root"
[ma]
app_name = "ma"
app_dir = "/web/shenlan"
app_log_dir = ""
app_log_filename = ""
app_uid = "www-data"
app_gid = "www-data"
app_suid = "root"
app_sgid = "root"
[marketing]
app_name = "marketing"
app_dir = "/web/shenlan"
app_log_dir = ""
app_log_filename = ""
app_uid = "www-data"
app_gid = "www-data"
app_suid = "root"
app_sgid = "root"
[official-web]
app_name = "official-web"
app_dir = "/web/shenlan"
app_log_dir = ""
app_log_filename = ""
app_uid = "www-data"
app_gid = "www-data"
app_suid = "root"
app_sgid = "root"
[prev_book]
app_name = "prev_book"
app_dir = "/web/shenlan"
app_log_dir = ""
app_log_filename = ""
app_uid = "www-data"
app_gid = "www-data"
app_suid = "root"
app_sgid = "root"
[prev_marketing]
app_name = "prev_marketing"
app_dir = "/web/shenlan"
app_log_dir = ""
app_log_filename = ""
app_uid = "www-data"
app_gid = "www-data"
app_suid = "root"
app_sgid = "root"
[prev_official-web]
app_name = "prev_official-web"
app_dir = "/web/shenlan"
app_log_dir = ""
app_log_filename = ""
app_uid = "www-data"
app_gid = "www-data"
app_suid = "root"
app_sgid = "root"
[prev_summer-hill]
app_name = "prev_summer-hill"
app_dir = "/web/shenlan"
app_log_dir = ""
app_log_filename = ""
app_uid = "www-data"
app_gid = "www-data"
app_suid = "root"
app_sgid = "root"
[prev_user-center]
app_name = "prev_user-center"
app_dir = "/web/shenlan"
app_log_dir = ""
app_log_filename = ""
app_uid = "www-data"
app_gid = "www-data"
app_suid = "root"
app_sgid = "root"
[sk]
app_name = "sk"
app_dir = "/web/shenlan"
app_log_dir = ""
app_log_filename = ""
app_uid = "www-data"
app_gid = "www-data"
app_suid = "root"
app_sgid = "root"
[summer-hill]
app_name = "summer-hill"
app_dir = "/web/shenlan"
app_log_dir = ""
app_log_filename = ""
app_uid = "www-data"
app_gid = "www-data"
app_suid = "root"
app_sgid = "root"
[summer-hill-test]
app_name = "summer-hill-test"
app_dir = "/web/shenlan"
app_log_dir = ""
app_log_filename = ""
app_uid = "www-data"
app_gid = "www-data"
app_suid = "root"
app_sgid = "root"
[user]
app_name = "user"
app_dir = "/web/shenlan"
app_log_dir = ""
app_log_filename = ""
app_uid = "www-data"
app_gid = "www-data"
app_suid = "root"
app_sgid = "root"
[user-center]
app_name = "user-center"
app_dir = "/web/shenlan"
app_log_dir = ""
app_log_filename = ""
app_uid = "www-data"
app_gid = "www-data"
app_suid = "root"
app_sgid = "root"
[video-center]
app_name = "video-center"
app_dir = "/web/shenlan"
app_log_dir = ""
app_log_filename = ""
app_uid = "www-data"
app_gid = "www-data"
app_suid = "root"
app_sgid = "root"
[www]
app_name = "www"
app_dir = "/web/shenlan"
app_log_dir = ""
app_log_filename = ""
app_uid = "www-data"
app_gid = "www-data"
app_suid = "root"
app_sgid = "root"
[jumper-admin]
app_name = "jumper-admin"
app_dir = "/web/neo"
app_log_dir = ""
app_log_filename = ""
app_uid = "www-data"
app_gid = "www-data"
app_suid = "root"
app_sgid = "root"
\ No newline at end of file
......@@ -7,22 +7,23 @@
# @Software: PyCharm
from checkitems import *
from tools import getConfig
'''
APP_LIST:应用列表
APP_DIR: 应用所在路径
LOG_LIST: 需要检查的日志文件
'''
APP_LIST = ['summer-hill','official-web','user-center']
APP_DIR = "/web/neo"
#日志列表
LOG_LIST = ['/usr/local/php7/var/log/php_errors.log']
CONFIG_FILE_NAME = './checklist.conf'
if __name__ == '__main__':
if len(sys.argv) < 2:
Usage()
if len(sys.argv) < 2:
Usage()
#参数由逗号分隔
appListName = sys.argv[1].split(",")
for appname in appListName:
dict=getConfig(CONFIG_FILE_NAME,apname)
for key,value in dict.items():
print(key,value)
'''
print("\033[1;33;40mALL is checking up......\033[0m")
for appname in appListName:
if appname in APP_LIST:
......@@ -39,4 +40,5 @@ if __name__ == '__main__':
else:
echo(log,"cannt be writen!",False,1)
echo(log, "had been checked!", True)
print("\033[1;33;40mALL is done to check up\033[0m")
\ No newline at end of file
print("\033[1;33;40mALL is done to check up\033[0m")
'''
\ No newline at end of file
......@@ -7,6 +7,7 @@
# @Software: PyCharm
import sys
import ConfigParser
def Usage():
print """Usage:
......@@ -21,3 +22,23 @@ def echo(cls,contents,flag,space=0):
print("%s\033[1;32;40m[+OK]: '%s' %s\033[0m" % (space,cls,contents))
else:
print("%s\033[5;31;40m[-ERR]: '%s' %s\033[0m" % (space,cls,contents))
def getConfig(config_file,appname):
cfg = ConfigParser.ConfigParser()
cfg.read(config_file)
app_dict = {}
app_dict['app_name'] = cfg.get(appname,"app_name")
app_dict['app_dir'] = cfg.get(appname,"app_dir")
app_dict['app_log_dir'] = cfg.get(appname, "app_log_dir")
app_dict['app_log_filename'] = cfg.get(appname, "app_log_filename")
app_dict['app_uid'] = cfg.get(appname, "app_uid")
app_dict['app_gid'] = cfg.get(appname, "app_gid")
app_dict['app_suid'] = cfg.get(appname, "app_suid")
app_dict['app_sgid'] = cfg.get(appname, "app_sgid")
return app_dict
'''
if __name__ == '__main__':
app_dict=getConfig("checklist.conf","summer-hill")
for key,value in app_dict.items():
print key,value
'''
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment