bash - tmux - attach to a session and specify window -
i have script (.sh) , want run in existing tmux session. have 1 session 8 windows in.
is there command tmux -t session-name
, specify window?
and script work?
#!/bin/bash tmux -t session-name #what ever write specify window# java -jar -xmx4g -xms4g spigot.jar
you can change active window of session before attach session.
tmux -t <session-name> select-window -t <windowid> tmux -t <session-name>
you can combine 2 tmux
commands well.
tmux -t session-name select-window -t <windowid> \;
if want run java, presumably want create new window new-window
, rather select existing 1 select-window
.
newer versions of tmux
(at least 1.9; did above ever work, perhaps in 1.6?) no longer appear have -t
option specify session apply commands to. instead, each individual command specifies session.
tmux select-window -t <session-name>:<windowid> \; -t <session-name>
Comments
Post a Comment