diff --git a/class/core/mw.py b/class/core/mw.py index 1cd83bbe5..abc19e930 100755 --- a/class/core/mw.py +++ b/class/core/mw.py @@ -91,6 +91,13 @@ def triggerTask(): writeFile(isTask, 'True') +def systemdCfgDir(): + cfg_dir = '/usr/lib/systemd/user' + if os.path.exists(cfg_dir): + return cfg_dir + return "/usr/lib/systemd/system" + + def getOs(): return sys.platform diff --git a/plugins/gogs/index.py b/plugins/gogs/index.py index 1340a8d57..c5ee31848 100755 --- a/plugins/gogs/index.py +++ b/plugins/gogs/index.py @@ -157,7 +157,7 @@ def initDreplace(): # mw.writeFile(conf_bin, content) # systemd - systemDir = '/usr/lib/systemd/system' + systemDir = mw.systemdCfgDir() systemService = systemDir + '/gogs.service' systemServiceTpl = getPluginDir() + '/init.d/gogs.service.tpl' if os.path.exists(systemDir) and not os.path.exists(systemService): diff --git a/plugins/memcached/index.py b/plugins/memcached/index.py index 3680952d7..19bfc3078 100755 --- a/plugins/memcached/index.py +++ b/plugins/memcached/index.py @@ -104,7 +104,7 @@ def initDreplace(): mw.execShell('chmod +x ' + file_bin) # systemd - systemDir = '/usr/lib/systemd/system' + systemDir = mw.systemdCfgDir() systemService = systemDir + '/memcached.service' systemServiceTpl = getPluginDir() + '/init.d/memcached.service.tpl' if os.path.exists(systemDir) and not os.path.exists(systemService): diff --git a/plugins/mongodb/install.sh b/plugins/mongodb/install.sh index 6ee89f742..cb7044b67 100755 --- a/plugins/mongodb/install.sh +++ b/plugins/mongodb/install.sh @@ -63,7 +63,7 @@ if [ -f /usr/lib/systemd/system/mongod.service ];then fi wget -qO - https://www.mongodb.org/static/pgp/server-${VERSION}.asc | sudo apt-key add - -sudo apt install gnupg +apt install -y gnupg touch /etc/apt/sources.list.d/mongodb-org-${VERSION}.list lsb_release -dc diff --git a/plugins/mysql/index.py b/plugins/mysql/index.py index 1351259d2..5645b06ae 100755 --- a/plugins/mysql/index.py +++ b/plugins/mysql/index.py @@ -182,7 +182,7 @@ def initDreplace(version=''): mw.writeFile(mysql_conf, content) # systemd - systemDir = '/usr/lib/systemd/system' + systemDir = mw.systemdCfgDir() systemService = systemDir + '/mysql.service' systemServiceTpl = getPluginDir() + '/init.d/mysql.service.tpl' if os.path.exists(systemDir) and not os.path.exists(systemService): diff --git a/plugins/openresty/index.py b/plugins/openresty/index.py index ead69db9f..05ef5a4a6 100755 --- a/plugins/openresty/index.py +++ b/plugins/openresty/index.py @@ -174,7 +174,7 @@ def initDreplace(): confReplace() # systemd - systemDir = '/usr/lib/systemd/system' + systemDir = mw.systemdCfgDir() systemService = systemDir + '/openresty.service' systemServiceTpl = getPluginDir() + '/init.d/openresty.service.tpl' if os.path.exists(systemDir) and not os.path.exists(systemService): diff --git a/plugins/php/index.py b/plugins/php/index.py index dab370a91..fa62ae474 100755 --- a/plugins/php/index.py +++ b/plugins/php/index.py @@ -253,7 +253,7 @@ def initReplace(version): mw.execShell('chown -R www:www ' + upload_path) # systemd - systemDir = '/usr/lib/systemd/system' + systemDir = mw.systemdCfgDir() systemService = systemDir + '/php' + version + '.service' systemServiceTpl = getPluginDir() + '/init.d/php.service.tpl' if version == '52': diff --git a/plugins/pureftp/index.py b/plugins/pureftp/index.py index e82704bd6..7b77bd6ad 100755 --- a/plugins/pureftp/index.py +++ b/plugins/pureftp/index.py @@ -117,7 +117,7 @@ def initDreplace(): mw.writeFile(pureFtpdConfig, content) # systemd - systemDir = '/usr/lib/systemd/system' + systemDir = mw.systemdCfgDir() systemService = systemDir + '/pureftp.service' systemServiceTpl = getPluginDir() + '/init.d/pureftp.service.tpl' diff --git a/plugins/redis/index.py b/plugins/redis/index.py index 4c9faf5d4..671d9b98d 100755 --- a/plugins/redis/index.py +++ b/plugins/redis/index.py @@ -104,7 +104,7 @@ def initDreplace(): mw.writeFile(dst_conf_init, 'ok') # systemd - systemDir = '/usr/lib/systemd/system' + systemDir = mw.systemdCfgDir() systemService = systemDir + '/redis.service' systemServiceTpl = getPluginDir() + '/init.d/redis.service.tpl' if os.path.exists(systemDir) and not os.path.exists(systemService): diff --git a/plugins/rsyncd/index.py b/plugins/rsyncd/index.py index 59352e164..d5be125c5 100755 --- a/plugins/rsyncd/index.py +++ b/plugins/rsyncd/index.py @@ -126,7 +126,7 @@ def initDreplace(): mw.execShell('chmod +x ' + file_bin) # systemd - systemDir = '/usr/lib/systemd/system' + systemDir = mw.systemdCfgDir() systemService = systemDir + '/rsyncd.service' systemServiceTpl = getPluginDir() + '/init.d/rsyncd.service.tpl' if os.path.exists(systemDir) and not os.path.exists(systemService): diff --git a/plugins/sphinx/index.py b/plugins/sphinx/index.py index 2c88586ef..55dd118e3 100755 --- a/plugins/sphinx/index.py +++ b/plugins/sphinx/index.py @@ -147,7 +147,7 @@ def initDreplace(): mw.writeFile(getServerDir() + '/sphinx.conf', conf_content) # systemd - systemDir = '/usr/lib/systemd/system' + systemDir = mw.systemdCfgDir() systemService = systemDir + '/sphinx.service' systemServiceTpl = getPluginDir() + '/init.d/sphinx.service.tpl' if os.path.exists(systemDir) and not os.path.exists(systemService): diff --git a/plugins/supervisor/index.py b/plugins/supervisor/index.py index 47ebd6128..9d576ce96 100755 --- a/plugins/supervisor/index.py +++ b/plugins/supervisor/index.py @@ -81,7 +81,7 @@ def initDreplace(): confD = getServerDir() + "/conf.d" conf = getServerDir() + "/supervisor.conf" - systemDir = '/lib/systemd/system' + systemDir = mw.systemdCfgDir() systemService = systemDir + '/supervisor.service' systemServiceTpl = getPluginDir() + '/init.d/supervisor.service' diff --git a/plugins/swap/index.py b/plugins/swap/index.py index efb1a207f..ebad36601 100755 --- a/plugins/swap/index.py +++ b/plugins/swap/index.py @@ -84,7 +84,7 @@ def initDreplace(): mw.execShell('chmod +x ' + file_bin) # systemd - systemDir = '/usr/lib/systemd/system' + systemDir = mw.systemdCfgDir() systemService = systemDir + '/swap.service' systemServiceTpl = getPluginDir() + '/init.d/swap.service.tpl' if os.path.exists(systemDir) and not os.path.exists(systemService):