![]() ![]() You could simplify all this by using iTerm2Ĭreate a Profile for each system you wish to start an ssh session.Īssign a Command-Control- letter to each profile This is only one approach, but it sounds like it's along the lines of what you were looking for. You may also be able to do something with BetterTouchTool to pass in parameters rather than hardcoding the commands in the script - that requires more knowledge of BetterTouchTool than I have. You can duplicate the second script as many times as you like for as many connection/command combinations as you like. (here 'CodecBroker' is what I named my stay-open script. The broker identifies the target and sends the appropriate command. ![]() This second script simply sends a message to the broker script and passes in the connection identifier and the command to run. Then the script then sits idling in the background, doing nothing until it's told to by the second script. Tell application "Terminal" to do script theCommand in codec3win Tell application "Terminal" to do script theCommand in codec2win Tell application "Terminal" to do script theCommand in codec1win Set codec3win to do script "ssh " & theUsername & & theHostname Set codec2win to do script "ssh " & theUsername & & theHostname Set codec1win to do script "ssh " & theUsername & & theHostname just open three connections - extend as much as you like ![]() It also saves a reference to each connection for later use (here I use labels 'codec1', 'codec2' and 'codec3', but you can use anything you like). You can open as many connections as you need. #Iterm2 keep ssh session alive windows#When launched it creates three new windows with separate ssh connections to the target. The first script should be saved as a stay-open application. Can you provide ideal numbers?Īs an example, here's an example of a message broker script. You then setup BetterTouchTool to call the appropriate script based on the codec you want to invoke, passing in the relevant parameters.Ī lot depends on the number of connections and commands you expect to manage. #Iterm2 keep ssh session alive series#Off hand I can see a couple of ways of doing this - one option would be a stay-open script that acts as a message broker, managing the requests from BetterTouchTool and passing them to the appropriate connection.Īnother approach is a series of scripts, each dedicated to a different codec/connection. I'm also not familiar with BetterTouchTool to know what options it has. In this case, with separate scripts, if script1 creates the SSH connection there's no simple way for script2 to know that.Ĭhanging the name of the window is ineffective and prone to error. My earlier approach of capturing the reference to each connection is based on staying within the script, where a simple variable can track which window maps to which connection. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |