jshells/uninstall_jsite.sh
2025-08-10 20:27:44 +08:00

35 lines
838 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
echo "开始卸载jsite运行环境..."
# 停止所有PM2进程
su - jingrow -c "pm2 delete all 2>/dev/null || true"
su - jingrow -c "pm2 unstartup 2>/dev/null || true"
# 停止traefik
cd /home/jingrow/traefik-docker 2>/dev/null && docker compose down 2>/dev/null || true
# 卸载PM2
su - jingrow -c "npm uninstall -g pm2 2>/dev/null || true"
# 卸载Node.js和NVM
su - jingrow -c "nvm uninstall $NODE_VERSION 2>/dev/null || true"
rm -rf /home/jingrow/.nvm
# 卸载Docker
apt-get remove -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
apt-get autoremove -y
# 删除所有目录
rm -rf /home/jingrow/jsite
rm -rf /home/jingrow/traefik-docker
# 删除用户
userdel -r jingrow 2>/dev/null || true
echo "jsite运行环境卸载完成"
# 重启系统
echo "系统将在3秒后重启..."
sleep 3
reboot