code wiki / _hdl_build / nx_vroom_autodeploy_cron.nx

nx_vroom_autodeploy_cron.nx

buildroot/runtime/_hdl_build/nx_vroom_autodeploy_cron.nx

3135 B39 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic vroom
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_vroom_autodeploy_cron.nx

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

main sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close pw sys_write slen sys_exit sys_openat_wr sys_write ↻ sys_close ↻ slen ↻

structs

none

consts

11const 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"
12const 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

14func slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 2: pwmain
15func pw(s: *u8) -> i64 { sys_write(1,s,slen(s)); return 0 }
called by 1: main calls 2: sys_writeslen
16func 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 }
18func main() -> i64