Recently I wanted to run couple of scripts for a certain period of time. After some digging, I found this wonderful tool called "timeout" which is actually a default program in almost all major GNU/Linux distributions. In this article I'm going to explain a bit about this wonderful program.
First of all, you can view the man page for this command by running,
man timeout
Next, I will explain little bit more about the usage of this program.This command has two basic arguments. First argument is the time, and the argument is the command we want to run. We can even provide a bash script as the second argument.
For an example, if I want to ping duckduckgo.com for two seconds, I can run this command like this,
timeout 2s ping duckduckgo.com
As you can see, this program is not only simple, but also it's very powerful. I use this to kill couple of really annoying node apps in one of my servers.
You can go through the man page I mentioned above to learn more about this program.
0 comments:
Post a Comment