Q:

Restart tmux sessions in Ubuntu (running Python)

I have five background processes running in tmux on my Ubuntu server. Each pane is a python script that is a never ending while loop.
$ tmux ls

process1: 1 windows (created Fri Dec 14 10:12:40 2018) [143x31]
process2: 1 windows (created Fri Jan 11 10:23:55 2019) [128x30]
process3: 1 windows (created Sun Feb 10 13:30:03 2019) [143x33]
process4: 1 windows (created Tue Dec 18 22:41:50 2018) [145x33]
process5: 1 windows (created Mon Jan 14 15:42:04 2019) [143x33]

Is there a command to stop and start, or restart, all services? Rather than going into each one and manually stopping and restarting it?
Thanks

A:

The easiest method will probably involve 
bind-key * set-window-option synchronize-pane

This bind (or any other key you choose to set) will allow you to type <prefix>* to begin typing to all panes in your window. (Undo this feature with <prefix>* again)
For your use case, to stop them all, you'd send C-C to all panes by literally typing Ctrl+C. To restart all the processes, just hit the up arrow to go back in each pane's history (or type !! if you prefer) and then hit Enter to start those up again.
This assumes that starting each process takes the same number of commands in each pane.
I've checked, and I can't find a way to make a tmux pane restart its current process; tmux doesn't seem to know enough about the terminals it's displaying for a more resilient answer.

