Commit 1a562ef7 by zhangwei

增加注释

parent e5e368da
...@@ -12,6 +12,14 @@ import os ...@@ -12,6 +12,14 @@ import os
import stat import stat
import pwd import pwd
'''
checkIsDirectory: 检查应用的物理路径是否为一个有效的目录
checkPermission: 检查应用路径中文件及其目录的属主,默认为www-data
checkDirectoryIsWrite: 检查目标是否被提供的用户可写,默认可写用户为www-data
traversal: 遍历目录
check: 检查入口
'''
def checkIsDirectory(path): def checkIsDirectory(path):
# print(path) # print(path)
if not os.path.isdir(path): if not os.path.isdir(path):
...@@ -42,9 +50,9 @@ def traversal(root): ...@@ -42,9 +50,9 @@ def traversal(root):
for dirname in dirnames: for dirname in dirnames:
yield os.path.join(dirpath,dirname) yield os.path.join(dirpath,dirname)
def check(appname,appdir): def check(appname,appdir):
d="%s/%s" % (appdir,appname) d="%s/%s" % (appdir,appname)
#检查是否是存在一个软连接
if not os.path.islink(d): if not os.path.islink(d):
echo(appname,"link isnt exits!",False,space=1) echo(appname,"link isnt exits!",False,space=1)
sys.exit(1) sys.exit(1)
......
...@@ -8,13 +8,20 @@ ...@@ -8,13 +8,20 @@
from checklist.checkitems import * from checklist.checkitems import *
'''
APP_LIST:应用列表
APP_DIR: 应用所在路径
LOG_LIST: 需要检查的日志文件
'''
APP_LIST = ['summer-hill','official-web','user-center'] APP_LIST = ['summer-hill','official-web','user-center']
LOG_LIST = ['/usr/local/php7/var/log/php_errors.log']
APP_DIR = "/web/neo" APP_DIR = "/web/neo"
LOG_LIST = ['/usr/local/php7/var/log/php_errors.log']
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:
if appname in APP_LIST: if appname in APP_LIST:
......
...@@ -10,8 +10,8 @@ import sys ...@@ -10,8 +10,8 @@ import sys
def Usage(): def Usage():
print """Usage: print """Usage:
python checklist.py appname python checklist.py appname1[,appname2,appname3...]
- appname: application name,eg:summer-hill - appname: application name,eg:summer-hill[,user-center]
""" """
sys.exit(1) sys.exit(1)
......
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