Skip to content

Commit

Permalink
fix: 🐛 plugin cannot be started, log emptying error
Browse files Browse the repository at this point in the history
  • Loading branch information
aoaostar committed Jul 28, 2022
1 parent cf7e6e4 commit d9bb971
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
13 changes: 7 additions & 6 deletions alidrive_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,13 @@ def get_logs(self, args):
return f_body

def clear_logs(self, args):
dirname = os.path.dirname(self.__logs_file)
listdir = os.listdir(dirname)
for p in listdir:
path_join = os.path.join(dirname, p)
if os.path.isfile(path_join):
os.remove(path_join)
if os.path.isfile(self.__logs_file):
dirname = os.path.dirname(self.__logs_file)
listdir = os.listdir(dirname)
for p in listdir:
path_join = os.path.join(dirname, p)
if os.path.isfile(path_join):
os.remove(path_join)
return public.returnMsg(True, "清除成功")

def exec_clean(self, args):
Expand Down
7 changes: 3 additions & 4 deletions alidrive_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,14 @@ def alidrive_status(self):
return True
return False

def server_status(self):
def server_status(self, num=0):
exec_shell = public.ExecShell("ps -ef | grep alidrive_server.py | grep -v grep | wc -l")
if exec_shell[1] == "" and int(exec_shell[0]) > 0:
if exec_shell[1] == "" and int(exec_shell[0]) > num:
return True
return False

def server_start(self):

if self.server_status():
if self.server_status(1):
return

# 启动定时任务
Expand Down

0 comments on commit d9bb971

Please sign in to comment.