Difference between revisions of "Stop a program if it takes more than given time to execute"
From Notes_Wiki
m |
m |
||
Line 1: | Line 1: | ||
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Server administration tips and tricks]] > [[Stop a program if it takes more than given time to execute]] | |||
Sometimes there is need of timing out a program and killing it, if it takes more than specified time to execute. To achieve this there is a command '<tt>timeout</tt>' with following syntax: | Sometimes there is need of timing out a program and killing it, if it takes more than specified time to execute. To achieve this there is a command '<tt>timeout</tt>' with following syntax: | ||
Line 16: | Line 15: | ||
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Server administration tips and tricks]] > [[Stop a program if it takes more than given time to execute]] | |||
Latest revision as of 15:56, 22 July 2022
Home > CentOS > CentOS 6.x > Server administration tips and tricks > Stop a program if it takes more than given time to execute
Sometimes there is need of timing out a program and killing it, if it takes more than specified time to execute. To achieve this there is a command 'timeout' with following syntax:
timeout <time><unit> <command>
For example
timeout 5s sleep 10
would terminate the sleep program after 5 seconds.
Home > CentOS > CentOS 6.x > Server administration tips and tricks > Stop a program if it takes more than given time to execute