Update common.py

pull/267/head
midoks 3 years ago
parent deb44571ef
commit 37e852b411
  1. 38
      class/core/common.py

@ -58,25 +58,25 @@ def doContentReplace(src, dst):
def initInitD(): def initInitD():
# systemctl # systemctl
sysCfgDir = mw.systemdCfgDir() # sysCfgDir = mw.systemdCfgDir()
if os.path.exists(sysCfgDir) and mw.getOsName() == 'centos' and mw.getOsID() == '9': # if os.path.exists(sysCfgDir) and mw.getOsName() == 'centos' and mw.getOsID() == '9':
systemd_mw = sysCfgDir + '/mw.service' # systemd_mw = sysCfgDir + '/mw.service'
systemd_mw_task = sysCfgDir + '/mw-task.service' # systemd_mw_task = sysCfgDir + '/mw-task.service'
systemd_mw_tpl = mw.getRunDir() + '/scripts/init.d/mw.service.tpl' # systemd_mw_tpl = mw.getRunDir() + '/scripts/init.d/mw.service.tpl'
systemd_mw_task_tpl = mw.getRunDir() + '/scripts/init.d/mw-task.service.tpl' # systemd_mw_task_tpl = mw.getRunDir() + '/scripts/init.d/mw-task.service.tpl'
if os.path.exists(systemd_mw): # if os.path.exists(systemd_mw):
os.remove(systemd_mw) # os.remove(systemd_mw)
if os.path.exists(systemd_mw_task): # if os.path.exists(systemd_mw_task):
os.remove(systemd_mw_task) # os.remove(systemd_mw_task)
doContentReplace(systemd_mw_tpl, systemd_mw) # doContentReplace(systemd_mw_tpl, systemd_mw)
doContentReplace(systemd_mw_task_tpl, systemd_mw_task) # doContentReplace(systemd_mw_task_tpl, systemd_mw_task)
mw.execShell('systemctl enable mw') # mw.execShell('systemctl enable mw')
mw.execShell('systemctl enable mw-task') # mw.execShell('systemctl enable mw-task')
mw.execShell('systemctl daemon-reload') # mw.execShell('systemctl daemon-reload')
script = mw.getRunDir() + '/scripts/init.d/mw.tpl' script = mw.getRunDir() + '/scripts/init.d/mw.tpl'
script_bin = mw.getRunDir() + '/scripts/init.d/mw' script_bin = mw.getRunDir() + '/scripts/init.d/mw'
@ -84,12 +84,12 @@ def initInitD():
mw.execShell('chmod +x ' + script_bin) mw.execShell('chmod +x ' + script_bin)
# 在linux系统中,确保/etc/init.d存在 # 在linux系统中,确保/etc/init.d存在
if not mw.isAppleSystem() and not os.path.exists("/etc/init.d"): if not mw.isAppleSystem() and not os.path.exists("/etc/rc.d/init.d"):
mw.execShell('mkdir -p /etc/init.d') mw.execShell('mkdir -p /etc/rc.d/init.d')
# initd # initd
if os.path.exists('/etc/init.d'): if os.path.exists('/etc/rc.d/init.d'):
initd_bin = '/etc/init.d/mw' initd_bin = '/etc/rc.d/init.d/mw'
if not os.path.exists(initd_bin): if not os.path.exists(initd_bin):
import shutil import shutil
shutil.copyfile(script_bin, initd_bin) shutil.copyfile(script_bin, initd_bin)

Loading…
Cancel
Save