I have multiple processes running, web server, auto-testing, compilation in background etc. Original code line commands such as node app.js or
lean midge: autotest .
To run all these processes with a script, type "background" and merge your output into a single standout (which is: showing it on the screen in the terminal) ?
One of the problems with easy bash solution is & amp;;) that the background processes on Ctrl + C are clearly kept alive, which is not desirable.
I have tried to add the trap
'$ kill (jobs -pr)' SIGINT SIGTERM exhaust but it does not seem to work reliably on OS X - surprisingly Node processes have been killed in the form, but Java still remains outside the script (via Ctrl + C).
I can use any scripting language. I would prefer Pure Bash or JS, but Python or Ruby is also fine.
I also like to preserve the ANSI escape color in the merged output.
You can use the multitail utility to not only log files to you , But arbitrarily produces CLI programs ( lein run , lein midje: autotest , ...).
Example:
$ Multitail - Marjol-CT ANSI-L "Layne Midsize: Autotast" - CT ANSI-L "Lean Ring Server-Headless"
Ctrl-C kills all the processes, which are being tailed.
If you are an OSX user, you can install multitail by using . Install multitail (assuming that you have already installed Homebree - if not, see)
To get more information about multityle configurations, you can use the man There are examples of usage on multitail read
No comments:
Post a Comment