mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 07:57:21 +08:00
feat: 添加面板卸载脚本
This commit is contained in:
12
README.md
12
README.md
@@ -51,6 +51,18 @@ CentOS Stream 可使用迁移脚本迁移至支持的系统: [CentOS 8/9 迁移
|
||||
bash <(curl -sSL https://dl.cdn.haozi.net/panel/install_panel.sh)
|
||||
```
|
||||
|
||||
## 卸载面板
|
||||
|
||||
优先建议备份数据重装系统,这样可以保证系统纯净。
|
||||
|
||||
如果你无法重装系统,请以`root`用户登录服务器,执行以下命令卸载面板:
|
||||
|
||||
```shell
|
||||
bash <(curl -sSL https://dl.cdn.haozi.net/panel/uninstall_panel.sh)
|
||||
```
|
||||
|
||||
卸载面板前请务必备份好所有数据,提前卸载面板全部插件。卸载后数据将**无法恢复**!
|
||||
|
||||
## 日常维护
|
||||
|
||||
使用`panel`命令进行日常维护:
|
||||
|
||||
12
README_EN.md
12
README_EN.md
@@ -51,6 +51,18 @@ If you decide to continue, please log in to the server as `root` user and execut
|
||||
bash <(curl -sSL https://dl.cdn.haozi.net/panel/install_panel.sh)
|
||||
```
|
||||
|
||||
## Uninstall Panel
|
||||
|
||||
Recommended to back up data and reinstall the system first, so that the system can be kept clean.
|
||||
|
||||
If you are unable to reinstall the system, log in to the server as the `root` user and execute the following command to uninstall the panel:
|
||||
|
||||
```shell
|
||||
bash <(curl -sSL https://dl.cdn.haozi.net/panel/uninstall_panel.sh)
|
||||
```
|
||||
|
||||
Before uninstalling the panel, please be sure to back up all data and uninstall all panel plugins in advance. The data will **not be recoverable** after uninstallation!
|
||||
|
||||
## Daily Maintenance
|
||||
|
||||
Use `panel` command for daily maintenance:
|
||||
|
||||
@@ -24,7 +24,7 @@ setup_Path="/www"
|
||||
sshPort=$(cat /etc/ssh/sshd_config | grep 'Port ' | awk '{print $2}')
|
||||
inChina=$(curl --retry 2 -m 10 -L https://www.cloudflare-cn.com/cdn-cgi/trace 2> /dev/null | grep -qx 'loc=CN' && echo "true" || echo "false")
|
||||
|
||||
Prepare_system() {
|
||||
Prepare_System() {
|
||||
if [ $(whoami) != "root" ]; then
|
||||
echo -e $HR
|
||||
echo "错误:请使用root用户运行安装命令。"
|
||||
@@ -290,12 +290,12 @@ fi
|
||||
echo -e $LOGO
|
||||
echo '安装面板依赖软件(如报错请检查 APT/Yum 源是否正常)'
|
||||
echo -e $HR
|
||||
sleep 3s
|
||||
Prepare_system
|
||||
sleep 2s
|
||||
Prepare_System
|
||||
Auto_Swap
|
||||
|
||||
echo -e $LOGO
|
||||
echo '安装面板运行环境(视网络情况可能需要较长时间)'
|
||||
echo -e $HR
|
||||
sleep 3s
|
||||
sleep 2s
|
||||
Init_Panel
|
||||
|
||||
86
scripts/uninstall_panel.sh
Normal file
86
scripts/uninstall_panel.sh
Normal file
@@ -0,0 +1,86 @@
|
||||
#!/bin/bash
|
||||
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
|
||||
|
||||
: '
|
||||
Copyright 2022 HaoZi Technology Co., Ltd.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
'
|
||||
|
||||
LOGO="+----------------------------------------------------\n| 耗子Linux面板卸载脚本\n+----------------------------------------------------\n| Copyright © 2022-"$(date +%Y)" 耗子科技 All rights reserved.\n+----------------------------------------------------"
|
||||
HR="+----------------------------------------------------"
|
||||
download_Url=""
|
||||
setup_Path="/www"
|
||||
|
||||
Prepare_System() {
|
||||
if [ $(whoami) != "root" ]; then
|
||||
echo -e $HR
|
||||
echo "错误:请使用root用户运行卸载命令。"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
isInstalled=$(systemctl status panel 2>&1 | grep "Active")
|
||||
if [ "${isInstalled}" == "" ]; then
|
||||
echo -e $HR
|
||||
echo "错误:耗子Linux面板未安装,无需卸载。"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! id -u "www" > /dev/null 2>&1; then
|
||||
groupadd www
|
||||
useradd -s /sbin/nologin -g www www
|
||||
fi
|
||||
}
|
||||
|
||||
Remove_Swap() {
|
||||
swapFile="${setup_Path}/swap"
|
||||
if [ -f "${swapFile}" ]; then
|
||||
swapoff ${swapFile}
|
||||
rm -f ${swapFile}
|
||||
sed -i '/swap/d' /etc/fstab
|
||||
fi
|
||||
}
|
||||
|
||||
Remove_Panel() {
|
||||
systemctl stop panel
|
||||
systemctl disable panel
|
||||
rm -f /etc/systemd/system/panel.service
|
||||
rm -rf ${setup_Path}
|
||||
}
|
||||
|
||||
clear
|
||||
echo -e "${LOGO}"
|
||||
|
||||
# 卸载确认
|
||||
echo -e "高危操作,卸载面板前请务必备份好所有数据,提前卸载面板所有插件!"
|
||||
echo -e "卸载面板后,所有数据将被清空,无法恢复!"
|
||||
read -r -p "输入 y 并回车以确认卸载面板:" uninstall
|
||||
if [ "${uninstall}" != 'y' ]; then
|
||||
echo "输入不正确,已退出卸载。"
|
||||
exit
|
||||
fi
|
||||
|
||||
echo -e "${LOGO}"
|
||||
echo '正在卸载耗子Linux面板...'
|
||||
echo -e $HR
|
||||
|
||||
Prepare_System
|
||||
Remove_Swap
|
||||
Remove_Panel
|
||||
|
||||
clear
|
||||
|
||||
echo -e "${LOGO}"
|
||||
echo '耗子Linux面板卸载完成。'
|
||||
echo '感谢您的使用,欢迎您再次使用耗子Linux面板。'
|
||||
echo -e $HR
|
||||
Reference in New Issue
Block a user