Sometimes I use command line programs, that want input after a rather long time, and it helps getting their jobs done, if there is an alert, an audio message and/or an info window on top of the current windows on the desktop. I am thinking of a graphical desktop environment or window manager. A special version might be made for Ubuntu Server that works in text mode unless the GUI tool works via a terminal window and via ssh
.
If I made my own program or if it is a small shellscript, I can modify it to produce the alert, but many programs are supplied without source code, or it is rather difficult to mess with it. So it would be nice to have a tool in the Ubuntu system, that can monitor most compiled programs as well as scripts and wake me up when a [slow] command line process wants my attention.
When something is written, it indicates that a program is waiting for input or has finished and the result is ready for me to use.
So how can I find or make a tool that monitors the activity in a terminal window and produces an alert, when something is written?
Monitoring the dialogue of a program and send an alert
You can monitor the activity of
viafifo
orxterm
log file using the shellscriptvialog
and let it start a
zenity
info message, when there is input from the monitored program. If you wish, you can also installespeak
and let it send an audio message.1. Start a
zenity
info message, when there is input from a monitored program using a fifo usingviafifo
.The following shellscript can monitor the output dialogue from a program and send an alert. It needs
espeak
andscript
(andscript
need not be installed in Ubuntu).viafifo
.viafifo
'/dev/stdin
,/dev/stdout
anddev/stderr
. The main task in the shellscript is the line with the programscript
, that is monitoring the activity in the terminal window and writing to the fifo.while
loopzenity
info message window and a correspoding spoken message withespeak
.You are expected to close the
zenity
window (can work with 'Enter') to get back to thexterm
window, where you write your input.Type
exit
to leavescript
andviafifo
. After that you can get a log file with the whole dialogue.2. Start a
zenity
info message, when something is written to anxterm
window (from the monitored program or from the user) usingvialog
.The following shellscript can monitor the dialogue with a program and send an alert. It needs
espeak
andxterm
.vialog
xterm
windowxterm
window (that is where you write your input)xterm
to get access to the output from and input to the program to be monitoredwhile
loopzenity
info message window and a correspondig spoken message withespeak
.You are expected to close the
zenity
window (can work with 'Enter') to get back to thexterm
window, where you write your input.Close the
xterm
window to stop monitoring.3. Ubuntu Server monitored remotely via
ssh
I checked, and these tools work with a server via a text mode connection via
ssh
to a computer with a graphical desktop environment.vialog
is started in the client (a laptop with Ubuntu persistent live).ssh
connects to the server and performs some time-consuming task (here illustrated by copying a couple of big iso files.