Commit 1a562ef7 by zhangwei

增加注释

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