助理巡檢改用字面絕對路徑,排程根目錄由 cron 條目帶入,避免無人值守輪次被權限層擋下 #14

Merged
admin merged 3 commits from fix/literal-absolute-paths-for-unattended-patrol into develop 2026-09-03 02:52:01 +00:00
2 changed files with 3 additions and 3 deletions
Showing only changes of commit 711eecac2f - Show all commits
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -34,7 +34,7 @@ Never work the root out instead. `readlink -f "$JSC_HOME/current"`, `ls -d "$JSC
Take the root once per invocation and reuse that one answer. Never resolve it again per call, never print it as a report line of its own, and never add a tool that prints it. Never test the root with a command either — an unattended round cannot, and the first script call is the test that matters anyway.
An empty token, an empty `readlink` result, or a path that is not absolute means there is no root to work with. Report it, say `jsc-cli:deploy` has to run, take the operation's `aborted` status, and stop. Never fall back to a cache path, and never create the root here. Completion condition: one literal absolute path is in hand and every later command line carries it, or the missing root was reported and the operation stopped.
An empty token, an empty `readlink` result, a path that is not absolute, or a resolved path that is not an existing directory means there is no root to work with. **That fourth item is the one the other three wave through.** With `JSC_HOME` unset, `readlink -f "$JSC_HOME/current"` prints `/current` and exits 0 — non-empty, absolute, and past every other item — and each literal path built from it then names a place that is not there. So the attended resolve is only accepted once `[ -d "{the path just printed}" ]` says that directory exists, run in the same approved step as the resolve itself. The unattended round tests nothing, exactly as above: its root was written into the entry by whoever installed the schedule, and its first script call is what fails if that root is wrong. Report it, say `jsc-cli:deploy` has to run, take the operation's `aborted` status, and stop. Never fall back to a cache path, and never create the root here. Completion condition: one literal absolute path is in hand and every later command line carries it, or the missing root was reported and the operation stopped.
## Every script call carries a literal absolute path