i just got interested in Developing OpenWRT and want to try somethings.
i'm trying to run a script right after my OpenWRT boots. here is my script file
[my custom chains]
i've placed this script file at
i wonder why this won't work. if i check at
/etc/rc.d, i can see
S99customchain.sh -> ../init.d/customchain.sh
when i manually restart script file at root directory with
/etc/init.d/customchain.sh i can see it applies well when i check via
but as i said, this won't automatically starts when i (re)boot my OpenWRT system.
authority is already given by using
i've already tried using
/etc/init.d/customchain enable and still doesn't work.
also i already checked similar question at here, and it doesn't have any answers.
what should i do?
there's a spot in the UI where you can define your own custom start script.
in 19.07 it's in System > Startup > Local startup (tab)
if you are telling me to use WEB UI, i'm trying to do this editing scripts inside sdk's files so i can compile in to .bin file
So i can't do what you told me to do
If it is iptables related, why don't you insert your custom rules in /etc/firewall.user?
it is related with iptables.
i tried insert those commands in to firewall.user
however, when i 'reboot' my device, it doesn't apply.
for this, i'm gonna make a new draft. please go check after about 5 minutes
if i manually run that script file, it works without any errors
start_service() is probably the one (auto startup)
and start() is for manual startup
try and use absolute directories for applications / files
and you can run your application/ script / config via an initscript
if you only want it to run on firstboot after new flash/upgrade or after system restore, you can add a uci_defaults script to your application
same result comes out with
PATH is not set yet when the script runs. Use the approach below to get the exact error messages.
It probably starts too early in the boot process to insert iptables and/or they may be flushed/overwritten by the firewall/other processes if they start later. I'd try logging from your init script to make sure it runs, if that's the case, you may have to employ a delay in boot() before running start_service. You may want to check the source for
simple-adblock for an example of waiting until network settles after boot.
PS. Not sure if START=99 is a meaningful value. I vaguely remember something about highest recommended value being 95 or even 90. You may want to search github for what other packages are using as a highest number.
i used START's value as 99 because i thought firewall's gonna flush my settings.
However my firewall starts at 30 and i've tried value for START around 40~50 too.
still i should use try using 90, 95
If START=99 is still too early, just insert a "sleep number-of-seconds" line in your startup script and adjust the number-of-seconds as necessary.
I don’t know if the below are exceptions to above, but I see those values used in these startup init scripts on my system.
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.