Wednesday, September 14, 2011
12:02 PM

To kill a process after specific duration


If you want to make sure that a certain process or application runs exactly for a given duration and gets kill automatically after that, then the command timeout will help.

Let us say we want to run google-chrome for only a minute and then kill it, then we can do the following

$ timeout 1m google-chrome

1m specifies 1 minute, similarly you can use the suffix "s" for seconds and suffix "d" for days.
As a result of the above command, google-chrome will launch and will get killed automatically at the end of 1 minute from the time the command was run.

0 comments:

Post a Comment