From 63145c736f03e9fc37cdb37302ea656b85ccea28 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sun, 3 Nov 2024 19:33:16 +0800 Subject: [PATCH] Update init_cmd.py --- web/admin/setup/init_cmd.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/web/admin/setup/init_cmd.py b/web/admin/setup/init_cmd.py index 434528a09..2818b3a2d 100644 --- a/web/admin/setup/init_cmd.py +++ b/web/admin/setup/init_cmd.py @@ -37,18 +37,19 @@ def init_cmd(): # initd if os.path.exists('/etc/rc.d/init.d'): initd_bin = '/etc/rc.d/init.d/mw' - if not os.path.exists(initd_bin): - shutil.copyfile(script_bin, initd_bin) - mw.execShell('chmod +x ' + initd_bin) + print(script_bin, initd_bin) + shutil.copyfile(script_bin, initd_bin) + mw.execShell('chmod +x ' + initd_bin) + + # 加入自启动 mw.execShell('which chkconfig && chkconfig --add mw') if os.path.exists('/etc/init.d'): initd_bin = '/etc/init.d/mw' - if not os.path.exists(initd_bin): - import shutil - shutil.copyfile(script_bin, initd_bin) - mw.execShell('chmod +x ' + initd_bin) + print(script_bin, initd_bin) + shutil.copyfile(script_bin, initd_bin) + mw.execShell('chmod +x ' + initd_bin) # 加入自启动 mw.execShell('which update-rc.d && update-rc.d -f mw defaults') return True \ No newline at end of file