Run one process (or more) into tmux

Let’s say you need to run a process like a lightweight private npm proxy registry such as Verdaccio and you do not want to use a Docker container.

You can run a simple command as

noup verdaccio &

. It might happen that the process fails at one point, then you need to restart it manually again.

Then you can adjust the previous command with something like

while true; do verdaccio; sleep 1; done &

and press return.

At this point the command is put in the background. However if in your config you have set

logs:
  - {type: stdout, format: pretty, level: http}

at the first hit on the webpage, logs will appear in the shell.

So, let’s make things clear and run the command in a tmux instead.

a. type tmux
b. type the verdaccio command (in the foreground)
c. type Ctrl+b then d to leave it running in the background
To get back to the session run tmux attach

You can run another verdaccio instance (with a different config for example) in the same tmux too:

d. When inside tmux, you can type Ctrl+B c to create a new shell
e. Then Ctrl+b n to cycle between them

Two tmuxes is also fine.