tech stuff.

Posts Tagged ‘tmux

Shells shells everywhere

leave a comment »

tmux makes it easy to construct a plethora of ssh connections via tmux neww "ssh $HOST", so I find myself frequently doing this from scripts.  tmux uses a shell to execute the ssh command, though, and I never liked how it left idle shells littering my process tree thusly:

\-+= 23132 user tmux: server (/tmp/tmux-505/default) (tmux)
  |-+= 25189 user sh -c sh
  | \--- 01613 user ssh hostA
  |-+= 08778 user sh -c sh
  | \--- 03665 user ssh hostB

Recently I actually bumped into my process limit and couldn’t spawn any new windows. This turned out to be pretty solve, though. I couldn’t figure out how to convince tmux not to use a shell to execute the command, but we can at least replace that shell process by telling the shell to exec rather than fork/exec. Now my script looks like this, and my process tree is nice and tidy.

let i=1
for host in $hosts; do
  tmux neww -d -n ${host%%.*} -t $session:$i "exec ssh $host"
  let i=i+1

Written by Lee Verberne

2011-06-12 at 08:48

Posted in BSD

Tagged with ,

OpenBSD creating additional ptys

with one comment

I like a lot of windows.  A lot of them.  Today I bumped into a default limit on OpenBSD 4.8 and tmux(1) started returning “No such file or directory” when I attempted to create a new window.  This turned out to be a simple thing to solve, though.

Read the rest of this entry »

Written by Lee Verberne

2011-03-16 at 10:21

Posted in BSD

Tagged with ,