How can I start serval applications in one script and pipe the output to current terminal?
For development I need a script which starts three webservers (on three ports, of course) and pipe the output of these to current terminal.
The difficult is to stop these webservers at the end of shell. I have to send a signal or better send [Ctrl + C] to all webservers.
I hope you’re understanding me 😉
EDIT
Script starts the other processes in the background and remembers their process IDs. It then waits for all of them to terminate. In the meantime, upon receiving a SIGINT (i.e. a
^C), it will kill those processes, which will then terminate the script too (for lack of more stuff to do). So by^C‘ing your script, you can kill all the background server processes.Oh yeah… I’m using netstat as a long-running test command. Substitute whatever you want to run.
Finally, you can choose which signal to send your processes with
kill. Checkman killfor options; I think INT (the equivalent of^C) is the default.