Coordinate two commands in separate panes in one tab

15 views
Skip to first unread message

Michael Klein

unread,
Dec 6, 2021, 10:53:54 AM12/6/21
to iterm2-discuss
I often need to run two commands (a server with a very chatty console and a terminal to execute commands in that server) in a coordinated way and I'd like to write a single script that will do all of the heavy lifting for me. But I can't quite figure out all the parts. Here's what I want:

1) When I run my script, the current tab is split horizontally into two panes, with one pane occupying the bottom 5 lines and the other taking up the rest. Run the `server` command in the upper pane and the `console` command in the lower pane.

2) When the `console` command exits, gracefully kill the `server` command and un-split the window.

Is this possible?

George Nachman

unread,
Dec 22, 2021, 7:59:15 PM12/22/21
to iterm2-...@googlegroups.com
You can do this with the Python API. Here’s a script that splits some panes: https://iterm2.com/python-api/examples/broadcast.html
As for killing the server command, the easiest thing to do is probably to run `console; killall server`

--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/iterm2-discuss/018b3b93-8a99-46ca-87f5-e9807bdd0279n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages