diff --git a/plugins/nezha/index.py b/plugins/nezha/index.py index c3c502ef9..e9427d2a4 100755 --- a/plugins/nezha/index.py +++ b/plugins/nezha/index.py @@ -190,6 +190,10 @@ class App: return file_agent_bin + def init_cfg(self): + self.initDreplace() + self.initDAgent() + def imOp(self, method): file = self.initDreplace() diff --git a/plugins/nezha/install.sh b/plugins/nezha/install.sh index 04a563fe9..01b4af5bf 100755 --- a/plugins/nezha/install.sh +++ b/plugins/nezha/install.sh @@ -23,3 +23,21 @@ if [ ! -d $curPath/versions/$2 ];then fi sh -x $curPath/versions/$2/install.sh $1 + +if [ "${action}" == "uninstall" ];then + if [ -f /usr/lib/systemd/system/nezha.service ] || [ -f /lib/systemd/system/nezha.service ] ;then + systemctl stop nezha + systemctl disable nezha + rm -rf /usr/lib/systemd/system/nezha.service + rm -rf /lib/systemd/system/nezha.service + systemctl daemon-reload + fi + + if [ -f /usr/lib/systemd/system/nezha-agent.service ] || [ -f /lib/systemd/system/nezha-agent.service ] ;then + systemctl stop nezha-agent + systemctl disable nezha-agent + rm -rf /usr/lib/systemd/system/nezha-agent.service + rm -rf /lib/systemd/system/nezha-agent.service + systemctl daemon-reload + fi +fi diff --git a/plugins/nezha/versions/0.15.2/install.sh b/plugins/nezha/versions/0.15.2/install.sh index 7dcefcfd0..a69ade4db 100755 --- a/plugins/nezha/versions/0.15.2/install.sh +++ b/plugins/nezha/versions/0.15.2/install.sh @@ -132,9 +132,7 @@ Install_App() if [ -d $serverPath/nezha ];then echo "$VERSION" > $serverPath/nezha/version.pl - - cd ${rootPath} && python3 ${rootPath}/plugins/nezha/index.py start - cd ${rootPath} && python3 ${rootPath}/plugins/nezha/index.py initd_install + cd ${rootPath} && python3 ${rootPath}/plugins/nezha/index.py init_cfg fi echo 'install successful' > $install_tmp } @@ -142,7 +140,9 @@ Install_App() Uninstall_App() { cd ${rootPath} && python3 ${rootPath}/plugins/nezha/index.py initd_uninstall + cd ${rootPath} && python3 ${rootPath}/plugins/nezha/index.py initd_uninstall_agent cd ${rootPath} && python3 ${rootPath}/plugins/nezha/index.py stop + cd ${rootPath} && python3 ${rootPath}/plugins/nezha/index.py stop_agent rm -rf $serverPath/nezha echo "install fail" > $install_tmp }