We do have a bash script, which we can run on a cluster access node, that executes htop on all cluster child nodes, in order for us to monitor the whole cluster at once.
Now my question is, whether, there is a way to bind Ctrl-C
or q
for this script, without having to use the tmux prefix. The idea is, that this would make the script behave very similar to the regular htop command (which uses the q key binding to quit), and other users would not have to dive into the specifics of how to use tmux, when wanting to quit the window.
I am aware, that there is a way to change the behaviour using the .tmux.conf
file. However, we do not want to set these keybinding globally, but only for this single script.
The command bash script looks like this:
tmux new -s logs_htop -d ssh-run htop 1
tmux select-pane -T 'cn01'
tmux splitw -v -p 50 -t logs_htop:0.0 ssh-run htop 5
tmux select-pane -T 'cn05'
tmux splitw -h -p 75 -t logs_htop:0.0 ssh-run htop 2
tmux select-pane -T 'cn02'
tmux splitw -h -p 66 -t logs_htop:0.1 ssh-run htop 3
tmux select-pane -T 'cn03'
tmux splitw -h -p 50 -t logs_htop:0.2 ssh-run htop 4
tmux select-pane -T 'cn04'
tmux splitw -h -p 75 -t logs_htop:0.4 ssh-run htop 6
tmux select-pane -T 'cn06'
tmux splitw -h -p 66 -t logs_htop:0.5 ssh-run htop 7
tmux select-pane -T 'cn07'
tmux splitw -h -p 50 -t logs_htop:0.6 "watch squeue -al"
tmux select-pane -T 'squeue'
tmux attach -t logs_htop
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…