8

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
  • 156,901
  • 35
  • 231
  • 235
cathy
  • 81
  • 1
  • 1
  • 2

3 Answers3

11

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,904
  • 5
  • 39
  • 57
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
  • 38,570
  • 8
  • 95
  • 130
-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