mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
up
This commit is contained in:
@@ -16,7 +16,7 @@ pluginService('clean');
|
||||
|
||||
function pRead(){
|
||||
var readme = '<ul class="help-info-text c7">';
|
||||
readme += '<li>cd /www/server/mdserver-web && python3 /www/server/mdserver-web/clean/index.py clean</li>';
|
||||
readme += '<li>cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/clean/index.py clean</li>';
|
||||
readme += '</ul>';
|
||||
|
||||
$('.soft-man-con').html(readme);
|
||||
|
||||
+20
-6
@@ -89,6 +89,20 @@ def get_filePath_fileName_fileExt(filename):
|
||||
return filepath, shotname, extension
|
||||
|
||||
|
||||
def cleanFileLog(path):
|
||||
filepath, shotname, extension = get_filePath_fileName_fileExt(abspath)
|
||||
if extension == ".log":
|
||||
cmd = "echo \"\" >> " + abspath
|
||||
print(cmd)
|
||||
mw.execShell(cmd)
|
||||
|
||||
|
||||
def cleanDirLog(path):
|
||||
l = os.listdir(path)
|
||||
|
||||
print(l)
|
||||
|
||||
|
||||
def cleanLog():
|
||||
# 清理日志
|
||||
rootDir = "/var/log"
|
||||
@@ -100,6 +114,7 @@ def cleanLog():
|
||||
"rm -rf /var/log/secure-*",
|
||||
"rm -rf /var/log/spooler-*",
|
||||
"rm -rf /var/log/yum.log-*",
|
||||
"rm -rf /var/log/messages-*",
|
||||
"rm -rf /var/log/btmp-*",
|
||||
|
||||
]
|
||||
@@ -112,12 +127,11 @@ def cleanLog():
|
||||
# print(l)
|
||||
for x in range(len(l)):
|
||||
abspath = rootDir + "/" + l[x]
|
||||
filepath, shotname, extension = get_filePath_fileName_fileExt(abspath)
|
||||
if extension == ".log":
|
||||
cmd = "echo \"\" >> " + abspath
|
||||
print(cmd)
|
||||
print(mw.execShell(cmd))
|
||||
print(filepath, shotname, extension)
|
||||
if os.path.isfile(abspath):
|
||||
cleanFileLog(abspath)
|
||||
|
||||
if os.path.isdir(abspath):
|
||||
cleanDirLog(abspath)
|
||||
|
||||
print("clean end")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user