Is there a way to have wall messages show to desktop users?
Let's say I'm away from home, ssh-ing on my home computer. For any reason, I need it rebooted.
# shutdown -r +10
This sends a warning message every minute via wall
, which is completely invisible for normal desktop use by, say, my parents.
Is there any way wall
messages can reach the desktop via, say, notification.
Solution 1:
The internals of wall
and are so blocked off and ancient that there's really no way to pull the message from it once it's in there.
The only real idea put forward for this (the problem has been discussed before, many times) is to alter the shutdown
and reboot
scripts so they either make something available via dbus or (as we're only dealing with one computer and one fix) you could just have it send a notify-send message.
They are just scripts so you could just hack into them. But I think this is probably a cause worth pushing for. Submit a bug against Ubuntu and add your patches (just make sure they can work without needing to send the notification if there's no X environment). It's this sort of usability that we need.
I've never heard of gxmessage
before, but I would use notify-send
.
A full solution would need to cater for the possibility of multiple displays (eg multi-head, remote users, etc) but thankfully I wrote some code for that bit yesterday:
for display in `ps aux | grep -oE "/usr/bin/X\s[^ ]+" | cut -d " " -f 2`; do
DISPLAY=$display notify-send -u critical 'Shutdown notice' 'Save all your work. THE SYSTEM IS GOING DOWN!!' -i /usr/share/pixmaps/gnome-computer.png
done
(I'm using export instead of a -display
or --display
flag because I don't know that notify-send
takes either)
Solution 2:
You could send a message manually using zenity
zenity --warning --text "badp's about to restart the computer" --display=:0
Of course, you could include this in a script.
Solution 3:
You should be able to write a script that crateas a ptty and listens for written messages (from write or wall) and then forwards that on to a GUI output.