fix: root 启动限制改为提醒

This commit is contained in:
shiyue
2026-06-24 10:04:33 +08:00
parent 2f02270edc
commit a794607817
2 changed files with 6 additions and 2 deletions

View File

@@ -19,6 +19,10 @@ fail() {
exit 1
}
warn() {
printf '[cc-web pm2] WARNING: %s\n' "$*" >&2
}
ensure_command() {
local cmd="$1"
local hint="$2"
@@ -268,7 +272,7 @@ start_or_restart_app() {
main() {
if [[ "$(id -u)" -eq 0 ]]; then
fail "请使用 root 用户执行。该服务会启动 Claude/Codex 子进程root 运行风险过高。"
warn "当前正在使用 root 用户执行。该服务会启动 Claude/Codex 子进程root 运行风险较高,建议改用非 root 用户。"
fi
[[ -f "${ENTRY_PATH}" ]] || fail "找不到入口文件: ${ENTRY_PATH}"