Re: [K12OSN] Broadcast message to all user desktops

pedro noticioso (cucnews@yahoo.com)
Tue, 18 Mar 2003 11:05:44 -0800 (PST)


I think this is it
https://secure.rvglug.org/pipermail/rvglug/2002-January/001120.html

Maybe we need workstations to issue "xhost +SERVER" or
something, where should I put the line?

--- Chris Hobbs  wrote:
> David Trask wrote:
> > Is there a way to broadcast a message to all user
> desktops....for example
> > warning them to log out and save as the server
> will be going down.......I
> > tried xmessage, but it only went to me.....any
> ideas?
> > 
> > David N. Trask
> > Technology Teacher/Coordinator
> > Vassalboro Community School
> > dtrask@vcs.u52.k12.me.us
> > (207)923-3100
> 
> Here's a perl script someone posted to this list
> (and I forget who - shout 
> out and receive your credit :)
> 
> ----8< Cut Here >8----
> #!/usr/bin/perl -w
> 
> # xwall.pl is a simple script for displaying a
> message on all X terminals
> # connected to the server.  The first argument is a
> string to match in the
> # output of ps to find all X terminals; there must
> be one per terminal.
> # for GNOME, I use 'gnome-session'; for KDE you
> might try 'startkde'.
> 
> if (@ARGV != 3){
>          print "Usage:\n\txwall.pl match-string
> timeout message\n";
>          print "\t match-string specifies the
> processes to examine\n";
>          print "\t timeout determines how long the
> message will display\n";
>          print "\t message is the message to be
> displayed\n";
>          exit (1);
> }
> 
> $SIG{CHLD}="IGNORE"; # in the unlikely event a child
> exits before the parent
> 
> my ($procmatch, $timeout, $message) =
> ($ARGV[0],$ARGV[1],$ARGV[2]);
> 
> foreach $pid (split /\s/,`/sbin/pidof $procmatch`) {
>          my ($display, $xauthority);
>          foreach $envvar (split /\00/,`cat
> /proc/$pid/environ`){
>                  if ($envvar=~/DISPLAY=(.*)/){
> $display = $1; }
>                  if ($envvar=~/XAUTHORITY=(.*)/){
> $xauthority = $1; }
>          }
>          if ($display && $xauthority){
>                  if (fork() == 0) {
>                          $ENV{DISPLAY}=$display;
> $ENV{XAUTHORITY}=$xauthority;
>                          exec("xmessage -center
> -timeout $timeout '$message'");
>                  }
>          }
> }
> ----8< Cut Here >8----
> 
> 
> 
> -- 
> Chris Hobbs       Silver Valley Unified School
> District
> Head geek:              Technology Services
> Coordinator
> webmaster:  
> http://www.silvervalley.k12.ca.us/~chobbs/
> postmaster:              
> chobbs@silvervalley.k12.ca.us
> pgp: 
> http://www.silvervalley.k12.ca.us/~chobbs/key.asc
> 
> 
> 
> _______________________________________________
> K12OSN mailing list
> K12OSN@redhat.com
> https://listman.redhat.com/mailman/listinfo/k12osn
> For more info see 


__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com



_______________________________________________
K12OSN mailing list
K12OSN@redhat.com
https://listman.redhat.com/mailman/listinfo/k12osn
For more info see