greymd / tmux-xpanes

Awesome tmux-based terminal divider

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add -t bash -ci '<alias on ssh destination server to run>' to examples in docs

beevabeeva opened this issue · comments

Hi @greymd,

Firstly, thank you for this amazing piece of kit.
I've made a tool built on xpanes that really helped my research: htop cluster.

I've found myself building another tool using xpanes. This time, I needed to run an alias command on each of the servers in the cluster which I ssh into on xpanes. Similar to the tool mentioned earlier, just with an alias instead of htop.

I eventually figured out how this needs to be done from following the instructions here.

The following is a snippet from my Python script:

# Make ha partition hosts (mscluster1...mscluster10) procedurely:
ha = ""
for i in range(0,10):
    ha+= 'mscluster'+str(i+1)+" "


run2 = xpanes + " -C 2 -t -c \"ssh abank@{} -t bash -ci 'atm-run'\" " + ha
system(run2)

The -t bash -ci 'atm-run' allows me to execute my alias (atm-run) in each of the panes, corresponding to each node in the cluster.

I know there shouldn't be instructions for ssh options in these docs, but it seems to me like it would be beneficial to have this as one of the examples in the docs.
At the very least, this issue will remind me of how to do this in the future 😋

All the best

Hi @beevabeeva ,
Thank you for letting me know your awesome usecase and htop cluster!

The doc has already had the example of ssh -t which is useful to run particular commands (like top) on remote server.
But as you mentioned, it does not have the example for running the bash's alias with interactive screen (bash -ic) and it might be helpful example for someone else.
If I found common usecase that requires bash alias on server, I will add an example to the doc when next version is released.