Answer the question
In order to leave comments, you need to log in
How to use one terminal for multiple processes?
Disclaimer: There are many tools that partially solve my problem. Their list and what exactly I am missing will be below.
Context / What I'm doing: I'm
working on an arbitrary application. To build and work with which you need to run several processes. All of them will work until I manually kill them. They can write to stdout at very different rates. Most often, I'm interested in what each of the processes writes and which one does it. Such processes can be:
- a local statics server
- several application servers
- several bundlers (webpack / gulp / typescript) for different parts of the application
- a synchronization utility
- linters
, etc.
What I need:
-one command: to have it all run in one command (done by a shell script)
- mixed output: so that all processes write the same tab (more below)
- process marking: the output of the process must be somehow marked so that it is clear what to what it refers
to - throtling switching: if 2 processes write alternately at the same time, it will be impossible to read the output of either of them
- process resource consumption output: (optional) it would be great, but in general it is not necessary to see how much resources each process consumes
- universality:(optional) it would be great if the solution was suitable (and fit well) for working not only on web projects (tmux vs. gulp), even better if it was also cross
-
platform The problem with vkaldka is that processes write at very different frequencies. That is, for example:
- collector 1 writes only at startup, and after, only with errors
- the application server writes every second
- another collector writes, for each change
Outputs of each process must be read. They can be arranged in tabs, but then the tab with "collector 1" will stand idle (with old entries) all the time,
while it will eat up significant screen space in vain. On the other hand, the active process will write a lot of hard-to-read text in a narrow tab.
Existing solutions
- app1 & app2 & app3
"ampersand" can be used to run multiple processes in the background, but:
- ✔️ (single command)
- ✔️ (mixed output)
- ❌ (process tagging): hard to tell which process outputs what
- ❌ (throtling switching): together with the previous point, it will be very difficult to figure it out
- ❌ (output of the resource consumption of the process)
- ✔️ (universality)
- tmux : (I assume that screen behaves the same way, but I'm not sure)
- ✔️ (one command)
- ❌ (mixed output): I didn't find a way to do combined output for tmux, only multiple parallel tabs
- ✔️ (tagging process): processes are easy to separate, but they are in different tabs
- ➖ (throtling toggle): not relevant
- ✔️ (output process resource consumption): have plugins
- ✔️ (generic)
- docker-compose :
- ✔️ (single command)
- ✔️ (mixed output)
- ✔️ (process marking)
- ❌ (throtling switching)
- ❔ (process resource consumption output)
❌ docker- compose does something very close to what I need, but I can't use it just for terminal output
-webpack / gulp
- its goals are completely different and sometimes you don’t want to pull it on a globe, and sometimes it’s impossible, plus it will be strange to use it outside of web development
- a self-written solution: I tried to write my own implementation of such a utility for mixing process outputs. Whether the required issues are more or less resolved in it, but still I want some kind of ready-made, run-in solution.
- ✔️ (single command)
- ✔️ (mixed output)
- ✔️ (process marking)
- ✔️ (throtling switching)
- ✔️ (process resource consumption output)
- ✔️ (universal)
❌ raw, requires development, support and optimization
Using my implementation, I wrote down how I want to see this process: https://asciinema.org/a/6SS3oCqgCy3RY1XUXYMVovMao
in the demo, 2 processes are launched, each of them writes its output to the console (123 or hello) once a second, but from -for throttling, only one process owns the output at a time for 5 seconds. After they expire, the output is given to another, which captures it for the next 5 seconds and displays everything that it wrote "into a draft". Resource output is also implemented. All this is done (as you can see) on Node.js.
Perhaps you know the tools that do something as similar as possible, but already ready?
Maybe you know how to teach tmux (or whatever) to write everything in one "combo tab"?
Maybe it can be done
Or what is the name of this type of output of several processes, so that I know what to google?
Answer the question
In order to leave comments, you need to log in
I came across this npm module: https://github.com/kimmobrunfeldt/concurrently#readme in my case it solves what I need quite well
You can try pm2.keymetrics.io , it should solve your problems, if anything, it works not only with the node
you creatively described a build management system like make. cmake and the like. deal with some, customize for yourself and use
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question