From 7dbc99b4f5400df38fa7f6e1b1f9e92ea971bade Mon Sep 17 00:00:00 2001 From: sdohuajia <63113882+sdohuajia@users.noreply.github.com> Date: Wed, 9 Oct 2024 20:54:44 +0800 Subject: [PATCH] Update nexus.sh --- nexus.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nexus.sh b/nexus.sh index dc58625..5b56e8a 100644 --- a/nexus.sh +++ b/nexus.sh @@ -4,6 +4,16 @@ SERVICE_NAME="nexus" SERVICE_FILE="/etc/systemd/system/nexus.service" # 更新服务文件路径 +# 脚本保存路径 +SCRIPT_PATH="$HOME/nexus.sh" + +# 检查是否以root用户运行脚本 +if [ "$(id -u)" != "0" ]; then + echo "此脚本需要以root用户权限运行。" + echo "请尝试使用 'sudo -i' 命令切换到root用户,然后再次运行此脚本。" + exit 1 +fi + # 主菜单函数 function main_menu() { while true; do