split multiple panes and ssh into server, run command, launch logs











up vote
0
down vote

favorite












I am running Ubuntu 18.04.1 and am trying to achieve the following.



I open my terminal and boot up tmux. I then run my bash script to split the window into 4 different panes. i then select each individual pane and ssh into a server, cd into a directory, launch a program, then tail the logs for said program.



Here's an example of what my bash script looks like.



tmux rename-window 'Logs';
tmux split-window -h;
tmux split-window -v ;
tmux select-pane -t 0;
tmux split-window -v ;
tmux select-pane -t 0 ;
tmux send-keys 'ssh user@server.com' enter ;
tmux send-keys 'p@sw0rd' enter ;
tmux send-keys 'cd dir/' enter ;
tmux send-keys './program/' enter ;
tmux send-keys 'tail -f logs/program.log' enter ;


again, i do this for each pane. When the script ends. The panes are successfully split and all 4 panes show the following.



bashFolder:$ ./tmuxBash (*this line is only shown on the original pane*)
ssh user@server.com
p@sw0rd
cd dir/
tail -f logs/program.log
me@laptopname:~home/bashFolder$ ssh user@server.com
user@server.com's password:


then all 4 panes are still expecting the password i tried to send after the initial ssh call.



This bash was working on a windows machine running linux through a VM (vagrant). I am not sure if I broke the script before I moved onto a linux box.



I appreciate any help, and my apologies for the format, this is my first post.










share|improve this question









New contributor




Deuces is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • You probably need to wait between sending the ssh command, before sending the password, as ssh will flush the input at the start so if you "type-ahead" it will be lost. Try sleep 5 or similar after the tmux ... ssh line.
    – meuh
    Nov 13 at 18:07















up vote
0
down vote

favorite












I am running Ubuntu 18.04.1 and am trying to achieve the following.



I open my terminal and boot up tmux. I then run my bash script to split the window into 4 different panes. i then select each individual pane and ssh into a server, cd into a directory, launch a program, then tail the logs for said program.



Here's an example of what my bash script looks like.



tmux rename-window 'Logs';
tmux split-window -h;
tmux split-window -v ;
tmux select-pane -t 0;
tmux split-window -v ;
tmux select-pane -t 0 ;
tmux send-keys 'ssh user@server.com' enter ;
tmux send-keys 'p@sw0rd' enter ;
tmux send-keys 'cd dir/' enter ;
tmux send-keys './program/' enter ;
tmux send-keys 'tail -f logs/program.log' enter ;


again, i do this for each pane. When the script ends. The panes are successfully split and all 4 panes show the following.



bashFolder:$ ./tmuxBash (*this line is only shown on the original pane*)
ssh user@server.com
p@sw0rd
cd dir/
tail -f logs/program.log
me@laptopname:~home/bashFolder$ ssh user@server.com
user@server.com's password:


then all 4 panes are still expecting the password i tried to send after the initial ssh call.



This bash was working on a windows machine running linux through a VM (vagrant). I am not sure if I broke the script before I moved onto a linux box.



I appreciate any help, and my apologies for the format, this is my first post.










share|improve this question









New contributor




Deuces is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • You probably need to wait between sending the ssh command, before sending the password, as ssh will flush the input at the start so if you "type-ahead" it will be lost. Try sleep 5 or similar after the tmux ... ssh line.
    – meuh
    Nov 13 at 18:07













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am running Ubuntu 18.04.1 and am trying to achieve the following.



I open my terminal and boot up tmux. I then run my bash script to split the window into 4 different panes. i then select each individual pane and ssh into a server, cd into a directory, launch a program, then tail the logs for said program.



Here's an example of what my bash script looks like.



tmux rename-window 'Logs';
tmux split-window -h;
tmux split-window -v ;
tmux select-pane -t 0;
tmux split-window -v ;
tmux select-pane -t 0 ;
tmux send-keys 'ssh user@server.com' enter ;
tmux send-keys 'p@sw0rd' enter ;
tmux send-keys 'cd dir/' enter ;
tmux send-keys './program/' enter ;
tmux send-keys 'tail -f logs/program.log' enter ;


again, i do this for each pane. When the script ends. The panes are successfully split and all 4 panes show the following.



bashFolder:$ ./tmuxBash (*this line is only shown on the original pane*)
ssh user@server.com
p@sw0rd
cd dir/
tail -f logs/program.log
me@laptopname:~home/bashFolder$ ssh user@server.com
user@server.com's password:


then all 4 panes are still expecting the password i tried to send after the initial ssh call.



This bash was working on a windows machine running linux through a VM (vagrant). I am not sure if I broke the script before I moved onto a linux box.



I appreciate any help, and my apologies for the format, this is my first post.










share|improve this question









New contributor




Deuces is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I am running Ubuntu 18.04.1 and am trying to achieve the following.



I open my terminal and boot up tmux. I then run my bash script to split the window into 4 different panes. i then select each individual pane and ssh into a server, cd into a directory, launch a program, then tail the logs for said program.



Here's an example of what my bash script looks like.



tmux rename-window 'Logs';
tmux split-window -h;
tmux split-window -v ;
tmux select-pane -t 0;
tmux split-window -v ;
tmux select-pane -t 0 ;
tmux send-keys 'ssh user@server.com' enter ;
tmux send-keys 'p@sw0rd' enter ;
tmux send-keys 'cd dir/' enter ;
tmux send-keys './program/' enter ;
tmux send-keys 'tail -f logs/program.log' enter ;


again, i do this for each pane. When the script ends. The panes are successfully split and all 4 panes show the following.



bashFolder:$ ./tmuxBash (*this line is only shown on the original pane*)
ssh user@server.com
p@sw0rd
cd dir/
tail -f logs/program.log
me@laptopname:~home/bashFolder$ ssh user@server.com
user@server.com's password:


then all 4 panes are still expecting the password i tried to send after the initial ssh call.



This bash was working on a windows machine running linux through a VM (vagrant). I am not sure if I broke the script before I moved onto a linux box.



I appreciate any help, and my apologies for the format, this is my first post.







ubuntu ssh tmux






share|improve this question









New contributor




Deuces is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Deuces is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Nov 13 at 17:59









Mr Shunz

1,6301516




1,6301516






New contributor




Deuces is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Nov 13 at 16:47









Deuces

11




11




New contributor




Deuces is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Deuces is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Deuces is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • You probably need to wait between sending the ssh command, before sending the password, as ssh will flush the input at the start so if you "type-ahead" it will be lost. Try sleep 5 or similar after the tmux ... ssh line.
    – meuh
    Nov 13 at 18:07


















  • You probably need to wait between sending the ssh command, before sending the password, as ssh will flush the input at the start so if you "type-ahead" it will be lost. Try sleep 5 or similar after the tmux ... ssh line.
    – meuh
    Nov 13 at 18:07
















You probably need to wait between sending the ssh command, before sending the password, as ssh will flush the input at the start so if you "type-ahead" it will be lost. Try sleep 5 or similar after the tmux ... ssh line.
– meuh
Nov 13 at 18:07




You probably need to wait between sending the ssh command, before sending the password, as ssh will flush the input at the start so if you "type-ahead" it will be lost. Try sleep 5 or similar after the tmux ... ssh line.
– meuh
Nov 13 at 18:07















active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






Deuces is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1375082%2fsplit-multiple-panes-and-ssh-into-server-run-command-launch-logs%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes








Deuces is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















Deuces is a new contributor. Be nice, and check out our Code of Conduct.













Deuces is a new contributor. Be nice, and check out our Code of Conduct.












Deuces is a new contributor. Be nice, and check out our Code of Conduct.















 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1375082%2fsplit-multiple-panes-and-ssh-into-server-run-command-launch-logs%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Список кардиналов, возведённых папой римским Каликстом III

Deduzione

Mysql.sock missing - “Can't connect to local MySQL server through socket”