What I want to achieve is to receive different notifications from a remote machine over ssh. For example when the long running job has finished.
One way is to send an message over xmpp, and have a jid client on a local machine. I want to do that without any intermediate server. I want to get this notifications via native system notification mechanism, so when the event raises I get a system popup, like the one I get using:
echo 'message:hi' | zenity --notification --listen
Or:
notify-send subject message
These work locally, but not with the remote session off course.
I am not available from network for a server I am connecting so it can't connect back to be over SSH and run notify-send
command.
So I am trying trying to solve this by forwarding local port to a remote machine and writing a small server/client app. Client will send a message to a forwarded port and server on my machine will call notify send
with the received message as an argument. But that looks like a wheel reinvention but I could not find a solution. Maybe it's possible to achieve with DBUS configuration.
Best Answer
Assume (just because logging is a common practice) your application (on remote server) writes each event in a file. So each new line in that file is a desired notification. The trick:
ssh my.remote.server 'tail -f /path/to/notifications/log' | while read line; do notify-send 'Server says' "$line"; done
So once new line will appear in the log on the server you will see popup on local desktop.