I am trying to configure a script that opens a terminal, does ssh on a remote server and executes a command (tail -F logfile in my case).
So far, I have been next
gnome-terminal -e 'ssh -t server "tail -F logfile"'
It works to some extent. -t ensures that signals such as SIGINT are sent through remotely executed commands.
However, when I ctrl-c tail, I would really like to go down to the bash terminal on the remote server. Right now, if I have ctrl-c tail, then the tail is closed, which causes ssh to exit, which causes the entire terminal to close.
I want the tail to be completed and stay with the bash shell on the remote server.
I tried the following:
gnome-terminal -e 'ssh -t server "tail -F logfile; /bin/bash"'
but this does not seem to work. That is, if I ran this without gnome-terminal, just ssh -t ..., you will see the following:
some lines
from the log
^CConnection to server closed.
But if I do
gnome-terminal -e 'ssh -t server "nonexistantcommand; /bin/bash"'
, nonexistantcommand , bash ...
- , ? .