forked from Eeveid/lightOps
实现 LightOps 运维面板基础功能
This commit is contained in:
27
scripts/uninstall-agent.sh
Executable file
27
scripts/uninstall-agent.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env sh
|
||||
set -eu
|
||||
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
echo "请使用 root 用户运行" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PURGE="0"
|
||||
while [ "$#" -gt 0 ]; do
|
||||
case "$1" in
|
||||
--purge) PURGE="1"; shift 1 ;;
|
||||
*) echo "未知参数:$1" >&2; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
systemctl disable --now lightops-agent 2>/dev/null || true
|
||||
rm -f /etc/systemd/system/lightops-agent.service
|
||||
systemctl daemon-reload
|
||||
rm -f /usr/local/bin/lightops-agent
|
||||
rm -f /usr/local/bin/lightops-agent.bak.*
|
||||
if [ "$PURGE" = "1" ]; then
|
||||
rm -rf /etc/lightops
|
||||
echo "LightOps Agent 已卸载,配置已清理"
|
||||
else
|
||||
echo "LightOps Agent 已卸载,配置保留在 /etc/lightops。需要完全清理请追加 --purge"
|
||||
fi
|
||||
Reference in New Issue
Block a user