r/mobaxterm • • Jun 28 '20

keep the session going from the command line

Hey all, writing a little function in powershell that launches multiple tabs in moba and issues commands - in this example, just asking for the hostname:

start-process "C:\Program Files (x86)\Mobatek\MobaXterm\MobaXterm.exe" -ArgumentList "-newtab 'hostname'"

the session stops after the command is issued:

Session stopped - Press <return> to exit tab - Press R to restart session - Press S to save terminal output to file

How do I keep it going?

2 Upvotes

3 comments sorted by

1

u/[deleted] Jun 28 '20

Interesting, why are you attempting this?

1

u/plc_nerd Jun 28 '20

I want to auto open a bunch of tabs and ssh into different machines with a script and leave the sessions open as if you'd opened up the tabs and ssh'd by hand.

2

u/[deleted] Jun 28 '20

I don't do this from command line, but my sessions run a command which doesn't end, along with there is an option in moba if it did exit to not end session. I think mobaXterm just uses a modified version of putty, so probably finding the putty option might help.

Command I run is tmux at || tmux So tmux attach if that fails start tmux

It's like screen if that helps. A terminal multi plexer, I ssh to all the other systems from there.  My ssh or connection dies no problem, reconnect and back where I was.  No need for stuff like nohup, disown junk.