[K12OSN] Broadcast message

Petre Scheie petre at maltzen.net
Fri Oct 29 15:21:44 UTC 2004

I, too, was playing with xmessage, on Luis's suggestion, and came up with this 
quick & dirty script (which I'll call brmsg for discussion purposes):


# brmsg: Send a broadcast message to all terminal screens

for x in `seq 1 30`
xmessage -center -timeout 10 -display 192.168.0.${x}:0.0 "$@" &

One would then call brmsg this way at a command prompt from the server:

brmsg Please logout now or you may be expelled

The message will pop up on the client for 10 seconds and then disappear.  It 
needs some refinement: For the seq range, it would be better to get a list of 
clients where someone is actually logged in so it doesn't waste time sending 
messages to irrelevant workstations; using 'who -T' and piping it to awk would 
be one way to get such a list.  And, as David suggested, and graphical version 
of this would be nicer; perhaps I'll try something in perl/tk this weekend (no 
gaurantees, I've got a ton of leaves to rake).

One requirement is that the client workstation must be configured to accept such 
messages, which in my server-and-one-client K12LSTP ver 3.0.1 here in my cube, 
the clients are not.  This can be fixed by adding

xhost +

to every user's ~/.profile.  This will allow such messages to be sent from the 
server, but not from other clients which could be a nightmare, e.g. clever 
students with too much time on their hands.

Hopefully this is a start.


David Trask wrote:
> Ok...I've never played with xmessage until now....I just tried it, but  
> xmessage -Hi There!  only shows up on my onw desktop.....how do I
> broadcast to all or at least to a chosen user?
> "Support list for opensource software in schools." <k12osn at redhat.com> on
> Friday, October 29, 2004 at 10:32 AM +0000 wrote:
>>This can be done using xmessage. Since it is part of XFree86, we don't 
>>have to worry about which window manager is being used.
>>One thing I'm not sure about are permission settings with xauth. It also 
>>need to have the DISPLAY environmental variable temporarily set to the 
>>display you wish the message to pop up on.
>>David Trask wrote:
>>>Ok....I think it's time we find a way to do this and incorporate it as a
>>>feature in something like TeacherTool.  It has been brought up way too
>>>many times.  This is a feature in Windows Terminal Server 2003 and should
>>>be in K12ltsp as well if we can figure it out.  Any ideas?
> David N. Trask
> Technology Teacher/Coordinator
> Vassalboro Community School
> dtrask at vcs.u52.k12.me.us
> (207)923-3100
> _______________________________________________
> K12OSN mailing list
> K12OSN at redhat.com
> https://www.redhat.com/mailman/listinfo/k12osn
> For more info see <http://www.k12os.org>

More information about the K12OSN mailing list