code wiki / _hdl_build / nx_vroom_autodeploy_cron.nx
nx_vroom_autodeploy_cron.nx
buildroot/runtime/_hdl_build/nx_vroom_autodeploy_cron.nx
about
nx_vroom_autodeploy_cron.nx -- STEP 2: add the /etc/crontab entry that runs nx_video_deploy.sh every
2 min (operator "get the auto deploy going"). elderwesto has full sudo; Synology cron needs root to
edit /etc/crontab. SECURITY: the vault password is interpolated by THIS organ into a heredoc fed to
`sudo -S` stdin -- so it is never in argv (no `ps` leak), never printed, never in my view, and /tmp/nxcmd
is shredded after. SAFE: backs up /etc/crontab first (cp -n, preserves original), idempotent (grep guard
= no duplicate line), fail-safe (sudo-auth-fail -> sh -c never runs -> crontab untouched). The cron line
runs as elderwesto (owns the served dir). Run AFTER nx_machine_key + _offc/nx_vault.elf open, then nx_ssh_cmd.
license_tier: ORIGINAL
dependencies 1 imports · 0 importers
imports: nx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 11 | const CRON_A: *u8 = "echo CRON_SETUP:; sudo -S -p '' sh -c 'cp -n /etc/crontab /etc/crontab.bak-nxvideo 2>/dev/null; grep -q nx_video_deploy /etc/crontab || printf \"%s\\n\" \"*/2 * * * * elderwesto /volume1/homes/elderwesto/nishihost/nx_video_deploy.sh >> /volume1/homes/elderwesto/nishihost/nx_video_deploy.cron.log 2>&1\" >> /etc/crontab; (synosystemctl restart crond || synoservice --restart crond) 2>/dev/null; true' <<'PWEOF'\n" |
| 12 | const CRON_B: *u8 = "\nPWEOF\necho SUDO_RC=$?; echo CRONTAB_CHECK:; grep -n nx_video_deploy /etc/crontab; echo TAIL:; tail -3 /etc/crontab; echo END\n" |
functions
| 14 | func slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 15 | func pw(s: *u8) -> i64 { sys_write(1,s,slen(s)); return 0 } |
| 16 | func pn(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1} sys_write(1,bb,k); return 0 } |
| 18 | func main() -> i64 |