mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-12 01:37:52 +08:00
🎈 Sync 2026-03-21 18:41:20
This commit is contained in:
1 parent
f9b782d3c8
commit
345b0373ec
9 files changed
+271
-247
No files matched your search
@@ -24,6 +24,14 @@ start_service() {
|
||||
|
||||
[ "$enabled" -eq 1 ] || return 0
|
||||
[ -n "$base_dir" ] || return 1
|
||||
if echo "$port" | grep -Eq '^[0-9]+$'; then
|
||||
if [ "$port" -le 1024 ] 2>/dev/null; then
|
||||
logger -t openclawmgr "Refusing to start: unsafe port ${port} (must be >1024)"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
|
||||
local node_bin="${base_dir}/node/bin/node"
|
||||
local global_dir="${base_dir}/global"
|
||||
@@ -52,7 +60,8 @@ start_service() {
|
||||
# OpenClaw uses --force to kill conflicting processes, but requires either `lsof`
|
||||
# or `fuser`. iStoreOS images may not include them by default.
|
||||
local force_opt=""
|
||||
if command -v lsof >/dev/null 2>&1 || command -v fuser >/dev/null 2>&1; then
|
||||
# Safety: never allow --force on privileged ports (it could kill SSH/LuCI when ports collide).
|
||||
if [ "$port" -gt 1024 ] 2>/dev/null && (command -v lsof >/dev/null 2>&1 || command -v fuser >/dev/null 2>&1); then
|
||||
force_opt="--force"
|
||||
fi
|
||||
|
||||
|
||||
Reference in new issue
Block a user