0

I want to create a script that allows some interactivity by

  • tail -f logfile from myService
  • allows text to be entered and sent to myService

What I could not solve yet is this two functions working parallel in one terminal. I would also like to achieve something in TTY I do not even know the word for:

,-------------------------.
| output here output here |
| output here output here |
|-------------------------|
( fixed input line here   )
 -------------------------

Is this even possible to achieve from a server-side bash script executed through ssh? How?

3 Answers3

2

Would it be sufficient to use screen or tmux in split mode?

command sequence for screen (default keymaps):

screen -
tail -f <logfile>
ctrl-a shift-s
ctrl-a <tab>
ctrl-a c
<send commands via shell>

command sequence for tmux (default keymaps):

tmux
tail -f <logfile>
ctrl-b "
<send commands via shell>
Andrew Domaszek
  • 5,163
  • 1
  • 15
  • 27
  • It would be great for myself, but this feature is created for common folk - I really do not want to expose them to all the screen possibilities. – Lorinc Nyitrai May 30 '14 at 14:27
1

It won't be possible with bash alone, but using dialog with the --tailbox feature might be what you are looking for.

Sven
  • 98,649
  • 14
  • 180
  • 226
1

tail -f never terminates, so that won't be possible - no tool can know when to add the fixed output line.

But you can do it with straight tail, if you wait until the logfile is written. I'm assuming you want to send the combination into the standard input of some other command, presumably one that integrates with your provider.

( tail /var/log/logfile ; echo "Fixed output line here" ) | /usr/bin/nextcommand
MadHatter
  • 79,770
  • 20
  • 184
  • 232
  • Unfortunately this is a continuous stream. Pretty much like a chat. When I was young and brave, MUDs worked this way from terminal. – Lorinc Nyitrai May 30 '14 at 14:33