mirror of https://github.com/midoks/mdserver-web
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
1.4 KiB
75 lines
1.4 KiB
# coding:utf-8
|
|
|
|
import sys
|
|
import io
|
|
import os
|
|
import time
|
|
|
|
sys.path.append(os.getcwd() + "/class/core")
|
|
import mw
|
|
|
|
app_debug = False
|
|
if mw.isAppleSystem():
|
|
app_debug = True
|
|
|
|
|
|
def getPluginName():
|
|
return 'mail'
|
|
|
|
|
|
def getPluginDir():
|
|
return mw.getPluginDir() + '/' + getPluginName()
|
|
|
|
|
|
def getServerDir():
|
|
return mw.getServerDir() + '/' + getPluginName()
|
|
|
|
|
|
def getInitDFile():
|
|
if app_debug:
|
|
return '/tmp/' + getPluginName()
|
|
return '/etc/init.d/' + getPluginName()
|
|
|
|
|
|
def getArgs():
|
|
args = sys.argv[3:]
|
|
tmp = {}
|
|
args_len = len(args)
|
|
|
|
if args_len == 1:
|
|
t = args[0].strip('{').strip('}')
|
|
t = t.split(':')
|
|
tmp[t[0]] = t[1]
|
|
elif args_len > 1:
|
|
for i in range(len(args)):
|
|
t = args[i].split(':')
|
|
tmp[t[0]] = t[1]
|
|
|
|
return tmp
|
|
|
|
|
|
def status():
|
|
data = mw.execShell(
|
|
"ps -ef|grep redis |grep -v grep | grep -v python | grep -v mdserver-web | awk '{print $2}'")
|
|
|
|
if data[0] == '':
|
|
return 'stop'
|
|
return 'start'
|
|
|
|
|
|
def runLog():
|
|
path = '/var/log/maillog'
|
|
# if "ubuntu" in:
|
|
# path = '/var/log/mail.log'
|
|
return path
|
|
|
|
if __name__ == "__main__":
|
|
func = sys.argv[1]
|
|
if func == 'status':
|
|
print(status())
|
|
elif func == 'conf':
|
|
print(getConf())
|
|
elif func == 'run_log':
|
|
print(runLog())
|
|
else:
|
|
print('error')
|
|
|