Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
1  
Thanks to information in the answers to this post, I could hack together a Python program that does just what I needed. It depends on the libnotify-bin package. –  badp Nov 11 '10 at 14:24

4 Answers 4

up vote 8 down vote accepted

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)

share|improve this answer
    
gxmessage is a ancient app. come to think of it dbus and notify-send is a much better option. Maybe i can work up something with zenity. –  tinhed Nov 11 '10 at 12:40
    
Yeah I'm not sure what's best. zenity warnings can be annoying if you're scrambling to get things saved before you're logged out... But notify-send notifications might just be ignored. –  Oli Nov 11 '10 at 12:49
1  
It's true that notify-send notification can be ignored but if displayed once a few ( e.g. 10 minutes ) they might do the job! –  OpenNingia Nov 11 '10 at 14:15
    
@Oli I've found you also need the XAUTHORITY environment variable correctly set for this to work, however. –  badp Nov 11 '10 at 14:22
1  
DISPLAY=$display notify-send... will only export that value of DISPLAY for that command; not that it matters here, but it's useful elsewhere and, IMHO, a bit cleaner. –  Roger Pate Nov 11 '10 at 14:34

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.

share|improve this answer
    
I can't open the display, even as superuser (I must sudo as the right user) :( –  badp Nov 11 '10 at 13:21
    
Should be able to - sure you've got the colon in there (=:0 not =0) –  misterben Nov 11 '10 at 13:27
    
couldn't, you also need the XAUTHORITY environment variable correctly set. –  badp Nov 11 '10 at 14:22

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.

share|improve this answer

AFAIK there is no X client for the wall command to display these message in a graphical environment. You can use gxmessage app for displaying popups but then you will have to write the script yourself.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.