For reference, my routers are Linksys EA8300.
Looking to run a couple of scripts a few minutes after my router has booted to start some servers.
Running these scripts as init scripts seem to stall the router from "fully booting" in a sense - the WPS light on my router stays flashing when normally it does not do this. Normally the router's logo lights up and the WPS light is off.
I've looked into using cron, but it doesn't quite fit what I'm looking for, since it seems like it can only schedule tasks based on clock time instead of time after boot. What other options are out there to do this?
You can use
If the delay is constant:
If the delay is different, add
sleep X to the beginning of each script and run all scripts in background:
Pavel for those with a graphical lean how would this be delayed by 120 seconds.
ntpd -d -n -q -N -I eth0 -p 18.104.22.168 -p 22.214.171.124
What notation in the code (if any) makes this background, or is the term background a given as it is running from
Thanks Jim, does that mean it is not sent to the system log?
You edit the same file using the GUI, so just add the delay above the command or use the
If the script does not run in background, the next script will start after the execution of the previous one.
Thus the scripts will start sequentially and the delays also will be sequential (superimposed).
& operator will make all scripts run at the same time.
You can probably redirect the script output (stdout and stderr) to
The OP's question is relevant and in order to absorb the solution, I have to visualize how it pertains to the item I have in
For the record, I did not intended to delay this
ntpd from executing and it is logged.
Tue May 17 14:21:42 2022 daemon.notice procd: /etc/rc.d/S95done: ntpd: sending query to 126.96.36.199
@anon89577378 I misunderstood what the term "background" meant in context to the function. >incorrectly thinking silent<
Thank you both for insights.
I'd suggest to include these in another script and call the script with
Otherwise the booting process will not finish until the last script exits, which may not be desirable.
My current problem is exactly this - I'm currently starting some servers via init scripts. However, it seems that the booting process is stalled indefinitely since the first server initialized keeps running (the other servers never get initialized) until the process is killed.
Would putting the scripts/commands in local startup aka
/etc/rc.local fix this issue?
For example, the following would be inside
command 1 &
command 2 &
Still learning the ropes with Linux.
Still not a good idea, as boot process will delay 5 minutes for no reason.
Either you put all of them in another script and run that script in rc.local with
& , or create a service which will run the script and you don't care about the
What's the difference between putting two commands into rc.local directly, each with an & at the end, and your method, where you put the two commands into one separate script, and call the script with an & at the end?
It's three commands, you forgot to count
Other than that you might want to keep one command running without sending it to background for some reason. This way you'd need to add them in a script and not run them in rc.local directly.