0

I need to execute bash command that may take a long time, but I need to kill it if this time exceeds 5 minutes for example!

Any ideas?

Dave Cross
  • 68,119
  • 3
  • 51
  • 97
samy adel
  • 1
  • 1

1 Answers1

2

You can use timeout command. For example

timeout 300 some_cmd

will kill some_cmd if it's still running after 300 seconds.

P.P
  • 117,907
  • 20
  • 175
  • 238