I issue a command task1 & task2 dir/ && task3 &
- Task1 never ends, so we send it to the background.
- Task2 changes the directory
- Task3 depends on task2 completing.
Issuing: jobs -l
will show:
[1]- 39281 Running task1 &
[2]+ 39282 Running task2 && task3 &
Issuing: ps
will show:
39281 ttys002 0:04.17 task1
39282 ttys002 0:00.00 task2
39283 ttys002 0:03.66 task3
Questions:
- Is there a way to show task3 in the jobs command output?
- Why doesn't task3 show up as a its own job?
- Is there a way to kill all three tasks simultaneously?
- Why doesn't task3 die if I kill task2?
- Is there a better way to do this?
Goal: Issue a single line of commands to init a workflow and send it to the background. When ready kill all started processes in one go.
For context and in my case, task1 is a grunt task with livereload, so it should be sent to the background. Task2 changes the directory so that task3 can watch files changed in that directory.