|
|
@ -97,24 +97,24 @@ def initDreplace(): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def start(): |
|
|
|
def start(): |
|
|
|
file = initDreplace() |
|
|
|
#file = initDreplace() |
|
|
|
data = mw.execShell(file + ' start') |
|
|
|
data = mw.execShell('systemctl start ' + getPluginName()) |
|
|
|
if data[1] == '': |
|
|
|
if data[1] == '': |
|
|
|
return 'ok' |
|
|
|
return 'ok' |
|
|
|
return 'fail' |
|
|
|
return 'fail' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def stop(): |
|
|
|
def stop(): |
|
|
|
file = initDreplace() |
|
|
|
# file = initDreplace() |
|
|
|
data = mw.execShell(file + ' stop') |
|
|
|
data = mw.execShell('systemctl stop ' + getPluginName()) |
|
|
|
if data[1] == '': |
|
|
|
if data[1] == '': |
|
|
|
return 'ok' |
|
|
|
return 'ok' |
|
|
|
return 'fail' |
|
|
|
return 'fail' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def restart(): |
|
|
|
def restart(): |
|
|
|
file = initDreplace() |
|
|
|
# file = initDreplace() |
|
|
|
data = mw.execShell(file + ' restart') |
|
|
|
data = mw.execShell('systemctl restart ' + getPluginName()) |
|
|
|
log_file = getServerDir() + "/data/redis.log" |
|
|
|
log_file = getServerDir() + "/data/redis.log" |
|
|
|
mw.execShell("echo '' > " + log_file) |
|
|
|
mw.execShell("echo '' > " + log_file) |
|
|
|
if data[1] == '': |
|
|
|
if data[1] == '': |
|
|
@ -123,8 +123,8 @@ def restart(): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def reload(): |
|
|
|
def reload(): |
|
|
|
file = initDreplace() |
|
|
|
# file = initDreplace() |
|
|
|
data = mw.execShell(file + ' reload') |
|
|
|
data = mw.execShell('systemctl restart ' + getPluginName()) |
|
|
|
if data[1] == '': |
|
|
|
if data[1] == '': |
|
|
|
return 'ok' |
|
|
|
return 'ok' |
|
|
|
return 'fail' |
|
|
|
return 'fail' |
|
|
@ -164,10 +164,13 @@ def initdStatus(): |
|
|
|
if not app_debug: |
|
|
|
if not app_debug: |
|
|
|
if mw.isAppleSystem(): |
|
|
|
if mw.isAppleSystem(): |
|
|
|
return "Apple Computer does not support" |
|
|
|
return "Apple Computer does not support" |
|
|
|
initd_bin = getInitDFile() |
|
|
|
|
|
|
|
if os.path.exists(initd_bin): |
|
|
|
shell_cmd = 'systemctl status ' + \ |
|
|
|
return 'ok' |
|
|
|
getPluginName() + ' | grep loaded | grep "enabled;"' |
|
|
|
return 'fail' |
|
|
|
data = mw.execShell(shell_cmd) |
|
|
|
|
|
|
|
if data[0] == '': |
|
|
|
|
|
|
|
return 'fail' |
|
|
|
|
|
|
|
return 'ok' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def initdInstall(): |
|
|
|
def initdInstall(): |
|
|
@ -176,11 +179,7 @@ def initdInstall(): |
|
|
|
if mw.isAppleSystem(): |
|
|
|
if mw.isAppleSystem(): |
|
|
|
return "Apple Computer does not support" |
|
|
|
return "Apple Computer does not support" |
|
|
|
|
|
|
|
|
|
|
|
source_bin = initDreplace() |
|
|
|
mw.execShell('systemctl enable ' + getPluginName()) |
|
|
|
initd_bin = getInitDFile() |
|
|
|
|
|
|
|
shutil.copyfile(source_bin, initd_bin) |
|
|
|
|
|
|
|
mw.execShell('chmod +x ' + initd_bin) |
|
|
|
|
|
|
|
mw.execShell('chkconfig --add ' + getPluginName()) |
|
|
|
|
|
|
|
return 'ok' |
|
|
|
return 'ok' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -189,9 +188,7 @@ def initdUinstall(): |
|
|
|
if mw.isAppleSystem(): |
|
|
|
if mw.isAppleSystem(): |
|
|
|
return "Apple Computer does not support" |
|
|
|
return "Apple Computer does not support" |
|
|
|
|
|
|
|
|
|
|
|
mw.execShell('chkconfig --del ' + getPluginName()) |
|
|
|
mw.execShell('systemctl disable ' + getPluginName()) |
|
|
|
initd_bin = getInitDFile() |
|
|
|
|
|
|
|
os.remove(initd_bin) |
|
|
|
|
|
|
|
return 'ok' |
|
|
|
return 'ok' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|