How to run programs in a non-blocking way from scripts

I have a series of program files, a.out, b.out, c.out

I want to execute them one after another after some delay between each program. as
. /a.out-input options
---- wait 50 seconds ----
./b.out- input parameters
----- wait 100 seconds ----
. /c.out

I want to execute b.out 50 seconds after a.out started the execution, but in a non-blocking way, that is, I do not want to wait 50 seconds after a.out completes the execution.

Can anyone suggest ways to do this on linux as I put this in a script that will automate tasks for me

+4
source share
3 answers

You need background processes:

./a.out -parameters & sleep 50 ./b.out -parameters & sleep 100 ./c.out & 

Background processes run without locking your terminal; you can manage them in a limited way using the jobs tool.

+7
source

To run it in the background, you can use a.out & .

For a timeout, consider command timeout in bash without undue delay .

0
source

You can use Bash script and sleep program:

 #!/bin/bash ./a.out -input parameters sleep 50 ./b.out -input parameters sleep 100 ./c.out 
-1
source

All Articles