Commit fda2f8eb by Builder

linux edit

parent b555f4dc
[book] [book]
app_name = "book" app_name = book
app_dir = "/web/shenlan" app_dir = /web/shenlan
app_log_dir = "" app_log_dir =
app_log_filename = "" app_log_filename =
app_uid = "www-data" app_uid = www-data
app_gid = "www-data" app_gid = www-data
app_suid = "root" app_suid = root
app_sgid = "root" app_sgid = root
[cdn] [cdn]
app_name = "cdn" app_name = cdn
app_dir = "/web/shenlan" app_dir = /web/shenlan
app_log_dir = "" app_log_dir =
app_log_filename = "" app_log_filename =
app_uid = "www-data" app_uid = www-data
app_gid = "www-data" app_gid = www-data
app_suid = "root" app_suid = root
app_sgid = "root" app_sgid = root
[ma] [ma]
app_name = "ma" app_name = ma
app_dir = "/web/shenlan" app_dir = /web/shenlan
app_log_dir = "" app_log_dir =
app_log_filename = "" app_log_filename =
app_uid = "www-data" app_uid = www-data
app_gid = "www-data" app_gid = www-data
app_suid = "root" app_suid = root
app_sgid = "root" app_sgid = root
[marketing] [marketing]
app_name = "marketing" app_name = marketing
app_dir = "/web/shenlan" app_dir = /web/shenlan
app_log_dir = "" app_log_dir =
app_log_filename = "" app_log_filename =
app_uid = "www-data" app_uid = www-data
app_gid = "www-data" app_gid = www-data
app_suid = "root" app_suid = root
app_sgid = "root" app_sgid = root
[official-web] [official-web]
app_name = "official-web" app_name = official-web
app_dir = "/web/shenlan" app_dir = /web/shenlan
app_log_dir = "" app_log_dir =
app_log_filename = "" app_log_filename =
app_uid = "www-data" app_uid = www-data
app_gid = "www-data" app_gid = www-data
app_suid = "root" app_suid = root
app_sgid = "root" app_sgid = root
[prev_book] [prev_book]
app_name = "prev_book" app_name = prev_book
app_dir = "/web/shenlan" app_dir = /web/shenlan
app_log_dir = "" app_log_dir =
app_log_filename = "" app_log_filename =
app_uid = "www-data" app_uid = www-data
app_gid = "www-data" app_gid = www-data
app_suid = "root" app_suid = root
app_sgid = "root" app_sgid = root
[prev_marketing] [prev_marketing]
app_name = "prev_marketing" app_name = prev_marketing
app_dir = "/web/shenlan" app_dir = /web/shenlan
app_log_dir = "" app_log_dir =
app_log_filename = "" app_log_filename =
app_uid = "www-data" app_uid = www-data
app_gid = "www-data" app_gid = www-data
app_suid = "root" app_suid = root
app_sgid = "root" app_sgid = root
[prev_official-web] [prev_official-web]
app_name = "prev_official-web" app_name = prev_official-web
app_dir = "/web/shenlan" app_dir = /web/shenlan
app_log_dir = "" app_log_dir =
app_log_filename = "" app_log_filename =
app_uid = "www-data" app_uid = www-data
app_gid = "www-data" app_gid = www-data
app_suid = "root" app_suid = root
app_sgid = "root" app_sgid = root
[prev_summer-hill] [prev_summer-hill]
app_name = "prev_summer-hill" app_name = prev_summer-hill
app_dir = "/web/shenlan" app_dir = /web/shenlan
app_log_dir = "" app_log_dir =
app_log_filename = "" app_log_filename =
app_uid = "www-data" app_uid = www-data
app_gid = "www-data" app_gid = www-data
app_suid = "root" app_suid = root
app_sgid = "root" app_sgid = root
[prev_user-center] [prev_user-center]
app_name = "prev_user-center" app_name = prev_user-center
app_dir = "/web/shenlan" app_dir = /web/shenlan
app_log_dir = "" app_log_dir =
app_log_filename = "" app_log_filename =
app_uid = "www-data" app_uid = www-data
app_gid = "www-data" app_gid = www-data
app_suid = "root" app_suid = root
app_sgid = "root" app_sgid = root
[sk] [sk]
app_name = "sk" app_name = sk
app_dir = "/web/shenlan" app_dir = /web/shenlan
app_log_dir = "" app_log_dir =
app_log_filename = "" app_log_filename =
app_uid = "www-data" app_uid = www-data
app_gid = "www-data" app_gid = www-data
app_suid = "root" app_suid = root
app_sgid = "root" app_sgid = root
[summer-hill] [summer-hill]
app_name = "summer-hill" app_name = summer-hill
app_dir = "/web/shenlan" app_dir = /web/shenlan
app_log_dir = "" app_log_dir =
app_log_filename = "" app_log_filename =
app_uid = "www-data" app_uid = www-data
app_gid = "www-data" app_gid = www-data
app_suid = "root" app_suid = root
app_sgid = "root" app_sgid = root
[summer-hill-test] [summer-hill-test]
app_name = "summer-hill-test" app_name = summer-hill-test
app_dir = "/web/shenlan" app_dir = /web/shenlan
app_log_dir = "" app_log_dir =
app_log_filename = "" app_log_filename =
app_uid = "www-data" app_uid = www-data
app_gid = "www-data" app_gid = www-data
app_suid = "root" app_suid = root
app_sgid = "root" app_sgid = root
[user] [user]
app_name = "user" app_name = user
app_dir = "/web/shenlan" app_dir = /web/shenlan
app_log_dir = "" app_log_dir =
app_log_filename = "" app_log_filename =
app_uid = "www-data" app_uid = www-data
app_gid = "www-data" app_gid = www-data
app_suid = "root" app_suid = root
app_sgid = "root" app_sgid = root
[user-center] [user-center]
app_name = "user-center" app_name = user-center
app_dir = "/web/shenlan" app_dir = /web/shenlan
app_log_dir = "" app_log_dir =
app_log_filename = "" app_log_filename =
app_uid = "www-data" app_uid = www-data
app_gid = "www-data" app_gid = www-data
app_suid = "root" app_suid = root
app_sgid = "root" app_sgid = root
[video-center] [video-center]
app_name = "video-center" app_name = video-center
app_dir = "/web/shenlan" app_dir = /web/shenlan
app_log_dir = "" app_log_dir =
app_log_filename = "" app_log_filename =
app_uid = "www-data" app_uid = www-data
app_gid = "www-data" app_gid = www-data
app_suid = "root" app_suid = root
app_sgid = "root" app_sgid = root
[www] [www]
app_name = "www" app_name = www
app_dir = "/web/shenlan" app_dir = /web/shenlan
app_log_dir = "" app_log_dir =
app_log_filename = "" app_log_filename =
app_uid = "www-data" app_uid = www-data
app_gid = "www-data" app_gid = www-data
app_suid = "root" app_suid = root
app_sgid = "root" app_sgid = root
[jumper-admin] [jumper-admin]
app_name = "jumper-admin" app_name = jumper-admin
app_dir = "/web/neo" app_dir = /web/neo
app_log_dir = "" app_log_dir =
app_log_filename = "" app_log_filename =
app_uid = "www-data" app_uid = www-data
app_gid = "www-data" app_gid = www-data
app_suid = "root" app_suid = root
app_sgid = "root" app_sgid = root
\ No newline at end of file
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
# @File : checklist.py # @File : checklist.py
# @Software: PyCharm # @Software: PyCharm
import sys
from checkitems import * from checkitems import *
from tools import getConfig from tools import getConfig
...@@ -14,31 +15,25 @@ LOG_LIST = ['/usr/local/php7/var/log/php_errors.log'] ...@@ -14,31 +15,25 @@ LOG_LIST = ['/usr/local/php7/var/log/php_errors.log']
CONFIG_FILE_NAME = './checklist.conf' CONFIG_FILE_NAME = './checklist.conf'
if __name__ == '__main__': if __name__ == '__main__':
if len(sys.argv) < 2: if len(sys.argv) < 2:
Usage() Usage()
#参数由逗号分隔 #参数由逗号分隔
appListName = sys.argv[1].split(",") appListName = sys.argv[1].split(",")
for appname in appListName: for appname in appListName:
dict=getConfig(CONFIG_FILE_NAME,apname) try:
for key,value in dict.items(): app_dict=getConfig(CONFIG_FILE_NAME,appname)
print(key,value) except Exception:
'''
print("\033[1;33;40mALL is checking up......\033[0m")
for appname in appListName:
if appname in APP_LIST:
echo(appname,"is checking......",True)
check(appname,APP_DIR)
else:
echo(appname,"not available!",False) echo(appname,"not available!",False)
echo(appname,"had been checked!",True) sys.exit(1)
print('*'*80) #for key,value in dict.items():
# print(key,value)
message("is checking......",appname)
#检查应用路径是否存在软连接、物理路径的权限
check(appname,app_dict['app_dir'])
for log in LOG_LIST: for log in LOG_LIST:
echo(log,"is checking......",True) message("is checking......",log)
if checkDirectoryIsWrite(log): if checkDirectoryIsWrite(log):
echo(log,"can be writen",True,1) echo(log,"can be writen",True,1)
else: else:
echo(log,"cannt be writen!",False,1) echo(log,"cannt be writen!",False,1)
echo(log, "had been checked!", True) message(" done","ALL","\033[1;33;40m")
print("\033[1;33;40mALL is done to check up\033[0m")
'''
\ No newline at end of file
...@@ -21,7 +21,11 @@ def echo(cls,contents,flag,space=0): ...@@ -21,7 +21,11 @@ def echo(cls,contents,flag,space=0):
if flag: if flag:
print("%s\033[1;32;40m[+OK]: '%s' %s\033[0m" % (space,cls,contents)) print("%s\033[1;32;40m[+OK]: '%s' %s\033[0m" % (space,cls,contents))
else: else:
print("%s\033[5;31;40m[-ERR]: '%s' %s\033[0m" % (space,cls,contents)) print("%s\033[1;31;40m[-ERR]: '%s' %s\033[0m" % (space,cls,contents))
def message(contents,cls="",colour="\033[0;34;40m",space=0):
space="\t"*space
print("%s%s'%s' %s\033[0m" % (space,colour,cls,contents))
def getConfig(config_file,appname): def getConfig(config_file,appname):
cfg = ConfigParser.ConfigParser() cfg = ConfigParser.ConfigParser()
...@@ -41,4 +45,4 @@ if __name__ == '__main__': ...@@ -41,4 +45,4 @@ if __name__ == '__main__':
app_dict=getConfig("checklist.conf","summer-hill") app_dict=getConfig("checklist.conf","summer-hill")
for key,value in app_dict.items(): for key,value in app_dict.items():
print key,value 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