Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
ops
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhangwei
ops
Commits
1a562ef7
Commit
1a562ef7
authored
Mar 10, 2017
by
zhangwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加注释
parent
e5e368da
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
4 deletions
+19
-4
checkitems.py
checklist/checkitems.py
+9
-1
checklist.py
checklist/checklist.py
+8
-1
tools.py
checklist/tools.py
+2
-2
No files found.
checklist/checkitems.py
View file @
1a562ef7
...
...
@@ -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
)
...
...
checklist/checklist.py
View file @
1a562ef7
...
...
@@ -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
:
...
...
checklist/tools.py
View file @
1a562ef7
...
...
@@ -10,8 +10,8 @@ import sys
def
Usage
():
print
"""Usage:
python checklist.py appname
- appname: application name,eg:summer-hill
python checklist.py appname
1[,appname2,appname3...]
- appname: application name,eg:summer-hill
[,user-center]
"""
sys
.
exit
(
1
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment