Using tmux as a remote command on login [1]

Using tmux as a remote command on login

Tuesday, September 16, 2014 12:34 AM - Jeff

Is there anyway to automatically run this remote command upon SSH login?

tmux a -t session || tmux new -s session

I can put this into PuTTY under "Connection/SSH/Remote command" and it works exactly like I need it to. But, obviously, I'd rather use Xshell!

I tried putting it under "Execute script when session starts" but that didn't do anything. I even tried just "tmux" and same thing.

Am I doing it wrong? Is this possible?

Thank you so much for your help and such an amazing program!!

P.S. Just in case, that command runs tmux and attaches to a session and if the session doesn't exist, it creates it for me. And tmux is a terminal multiplexer that is installed on my Linux server I'm trying to connect to.

Program Ver. : Xshell 4


Re: Using tmux as a remote command on login

Tuesday, September 16, 2014 8:03 PM - Support

You can do that with the login script feature. Please follow the steps below:

1. Open session properties.
2. Go to the Login Script menu.
3. Enable the Execute the following Expect and Send Rule option.
4. Click the Add button.
5. Set the Expect string. This should be your prompt.
6. For Send, enter, 'tmux a -t session || tmux new -s session'

Click OK to save the changes.

---
Technical SUpport


Previous views: 199