6

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

I want to execute them one after the other after certain delay between each program. like
./a.out -input parameters
----wait for 50 sec----
./b.out -input parameters
-----wait for 100 sec----
./c.out

I want to execute b.out 50 seconds after a.out has started execution but in a non-blocking way i.e. I don't want to wait for 50sec after a.out has finished execution.

Can anyone suggest ways of doing this in linux as I'm putting this into a script that will automate tasks for me

Shog9
  • 152,046
  • 34
  • 225
  • 232
cathy
  • 61
  • 1
  • 1
  • 2

3 Answers3

9

You want background processes:

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

Background processes run without blocking your terminal; you can control them in a limited way with the jobs facility.

Kilian Foth
  • 13,440
  • 4
  • 38
  • 55
1

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

For timeout, consider Timeout a command in bash without unnecessary delay .

Community
  • 1
  • 1
Sebastian Mach
  • 37,451
  • 6
  • 88
  • 128
-1

You could use a Bash script and the sleep program:

#!/bin/bash
./a.out -input parameters
sleep 50
./b.out -input parameters
sleep 100
./c.out
Martey
  • 1,631
  • 2
  • 13
  • 23