Posted: Wed Mar 18, 2020 15:24 Post subject: Startup scripts on JFFS not executing - My solution
Here's how I addressed the issue of ever-increasing time before the USB drive hosting my JFFS becomes available. That situation leads to the startup script(s) on JFFS never being executed.
In the Administration->Commands screen, create a startup script in NVRAM that looks like this:
#!/bin/sh
until [ -f /jffs/IPL.sh -a `nvram get wan_ipaddr` != "0.0.0.0" ]; do
sleep 1
done
/bin/sh /jffs/IPL.sh
In essence, the NVRAM startup script launches the JFFS startup script (IPL.sh in my setup) only after (1) USB drive is mounted and (2) WAN is up. It checks for those 2 conditions every second. That way, no need to code a fixed delay that might need adjustments.
Thanks for sharing! I just noticed entware wasn't always starting up on my dev/backup router. Added a one-liner based on yours as the first startup command and the race condition is gone. The second line is the usual entware startup command.