0

I have 3 tasks in a script which have to run as follow.

#1 and 2 need to run in parallel
task1 &
task2

#when task 1 is complete, task 3 is launched
task3

My problem is that task 2 being a continous process it prevents task 3 to be launched. Either I have to ignore task 2 condition or I could also kill task 2 when task1 is done, not a problem.

If someone has any idea so my script can go on ! Thanks

Bispen
  • 1

2 Answers2

3

If i've understood you right, you need this:

{ task1; task3; } &
task2
ValeriyKr
  • 929
0

Try this:

{ task1 ; task3 ; } & task2 &
Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
  • Thanks guys.

    If I add a new line with task4, it will then run once task3 complete ? (I actually still have a long thread of tasks behind task3).

    – Bispen Jan 05 '17 at 19:10
  • If you want to execute any thing after the task3 you add it in the first line like this : { task1 ; task3 ; task4; } & task2 & : tasks between braces will flollow the order of execution, they are also executed in the same shell, in background, the task2 will be executed in the same time but totally independent of others, in background too. Thanks – Hamza Jabbour Jan 06 '17 at 08:09