What's new

How to run the script with a runtime of 12 minutes

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Vladimir

New Around Here
First of all, please excuse me for my English.
I need to automatically run a script every time after rebooting the router, as well as the cron once a week.
The problem is that the execution time of this script is about 11-12 minutes. If I add it to one of the standard user scripts (for example, post-mount), its execution stops after 120 seconds. If I run it manually - it works fine.
Is there any way to automatically execute this script during/immediately after router reboot?
 
If you add a & to the command it should demonise it and not hit the 120 second limit.


Sent from my iPhone using Tapatalk
 
In theory yes.

The start scripts have an execution time limit of 120 seconds to complete everything. But if you add the & it forks the process away so the start script will continue as soon as it starts your script, rather than waiting 12 minutes to continue.


Sent from my iPhone using Tapatalk
 
That is, the script call should look like

Code:
 . ./my_script &

So simple? Thank you very much!
You need to specify the full path to the script, or have previously issued a "cd" command.

You wouldn't normally use the beginning ". " part. It depends on how your script is written.
 
That is, the script call should look like

Code:
 . ./my_script &

So simple? Thank you very much!
It is indeed is so simple.
I use similar code in Diversion for temporary files. The one below writes a file and destroys itself after 10 seconds.
Code:
cat <<-EOF > "/tmp/diversion-unmount"
        #!/bin/sh
        sleep 10
        rm -f /tmp/diversion-unmount
        EOF
sh /tmp/diversion-unmount >/dev/null &
The /dev/null prevents output in terminal.
 

Similar threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top