I need to execute a command with a timeout in OpenWRT, but it seems that the command timeout is not installed by default neither can be installed using opkg. I know that I can do a work around (using command &; sleep $DELAY; kill $!), but I wish to do this more properly without getting the risk of kill trying to kill a process in case the command finished before the timeout.
相关问题
- Timeout in authentication does not work properly
- Limiting the timeout period for Selenium FindEleme
- MS Captcha timeout duration in registration form i
- bash read timeout only for the first character ent
- Timeout for Z3 Optimize
相关文章
- How exactly do Firebase Analytics handle session d
- rxjs timeout to first value
- how do i set a timeout value for python's mech
- How to call two alternating functions in a loop ev
- Python web scraping: difference between sleep and
- recv() data of unknown size with Berkeley Sockets
- how to send reponse when timeout in node.js http m
- How do I reuse this JavaScript timeout closure?
Yes you can install timeout on openWRT
This has been tested with AA, pretty sure that would also work with BB.
timeout
is a shell command so it executes in a subshelltimeout 6 sleep 20
will work if executed in direct shell terminal but same command won't work if initiated from a shell script.So to run timeout in a shell script , use like this
out="$(timeout 6 sleep 20)"
ORecho "$(timeout 10 sleep 20)"
this will run your timeout and your command in one subshell
In short: it is not possible. I have to do it using
sleep
&&kill
.