I want to execute these two timeout command on the same command but with a different time and instructions. So

timeout --signal=SIGINT 5s command 
timeout --signal=SIGKILL 10s command

How to append them in one line?

  • timeout --signal=SIGKILL 10s { timeout --signal=SIGINT 5s command ; } or timeout --signal=SIGKILL 10s bash -c 'timeout --signal=SIGINT 5s command' ? – Costas Jan 18 '15 at 15:34
  • I don't understand what "in one line" is supposed to mean as cmd1 ; cmd2 is probably not what you are looking for. If you need this structure often and want to reduce code then you can write a function which calls its parameter like the two example lines. – Hauke Laging Jan 18 '15 at 17:35
  • no, I want if the first signal doesn`t work(in my command that is exactly the case) to kill it with the second signal(it works) – Highlights Factory Jan 18 '15 at 21:26
timeout --signal=SIGKILL 10s timeout --kill-after=5 --signal=SIGINT 5s command

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.