English
Ask Your Question
3

How to send messages to all clients in LAN graphically ?

asked 2011-11-21 06:24:02 +0000

sugreeva gravatar image

Hi I want to send messages like "All of you Please Log out... " to all terminals in LAN. Earlier text messages can be sent by terminal window. Now many people work in Graphical mode, How to send message to all in the LAN ?

One hope is Zenity. But it displays message in the local machine. How to make it display in all terminals ?

Thanks in advance....

Regards, Sugreeva, India

edit retag flag offensive close merge delete

6 answers

Sort by ยป oldest newest most voted
0

answered 2011-11-24 09:26:59 +0000

How about this (it's a bad hack):

  • set up a cron job on all the systems that polls per minute to check the existence of a file, say "~/saylogout"
  • when the file is present (touch <filename>), it calls a shell script that pops up "please save your work and log out or your data will be lost" using zenity and deletes the "~/saylogout" file?
  • when you want to "send" the message, you just need to write a script to iterate over the hosts on lan and touch the file

Like I said, bad hack ;)

edit flag offensive delete link more

Comments

Note: you can use notify-send or anything else, since it's going to be called on the local machine.

FranciscoD_ ( 2011-11-24 09:27:42 +0000 )edit
0

answered 2011-11-28 21:10:04 +0000

ryran gravatar image

updated 2011-11-28 21:28:21 +0000

Asto got it going, but I'll give it to you explicitly.

for host in $(<lanclients.txt); do ssh -X $host notify-send -u critical 'APOCALYPSE SOON' 'The network administrator wants you to log off ASAP!'&done

One of the problems with this is that it only works on a per-user basis; it's not like "wall". So until they add an option to notify-send to make your message get auto-sent to whoever is logged onto the desktop, you'll need to ssh in to systems with the credentials of the currently logged-in user. Your lanclients.txt file could look like this:

suresh@server1
madhuri@192.168.0.9
asha@gamebox

Also, in case it's not clear, you'll need to set up ssh-keys.

for host in $(<lanclients.txt); do ssh-copy-id $host; done

EDIT: I just realized this probably isn't going to work, but I don't have any machines handy to test. I'm working on a different solution.

edit flag offensive delete link more
0

answered 2011-11-28 22:31:06 +0000

ryran gravatar image

Well I could definitely see the use-case for this, so I coded up a little som'n-som'n that fills the need and put it up on github. Called it net-notifyd, for now.

I'll just paste in the info from the script itself:

# This simple script is designed to be run automatically when a user logs into
# their desktop. (In fedora open 'gnome-session-properties' & add it; log out.)
# It then sleeps in the background, waiting to receive a message from root via a
# fifo in /tmp. If it receives a keyword that it knows about, it displays a
# preset message to the user in the GUI, via the notify-send command.
#
# Perhaps it is obvious, but the idea here is that a SA could ssh into systems
# with a for loop and drop a keyword to the pipe, ensuring that a message
# would get displayed to the currently logged-in user, without having to worry
# about who they are.
#
# Explicit instructions:
# After running this script (preferably via gnome-session-properties), run:
#     echo warning > /tmp/net-notifyd
# either as yourself or as root to test it. As you can see below, "logout" is
# another keyword I created a message for. The daemon ignores anything else.
#
# I just named this in a hurry, so I haven't done any research on similarly-
# named projects. Let me know if you've got a better idea.                                                                                                                         
# Also, if you've got suggestions on implementation, I'm all ears!
edit flag offensive delete link more

Comments

Please mark the answer as correct if it solves your query @ryran.

FranciscoD_ ( 2011-11-30 10:14:37 +0000 )edit
0

answered 2011-11-21 19:11:25 +0000

q2dg gravatar image

It's a bit deprecated, but maybe it works... http://linpopup2.sourceforge.net

edit flag offensive delete link more
0

answered 2011-11-28 22:26:03 +0000

Desktop notification is in the works for Fedora 17

http://fedoraproject.org/wiki/Features/SystemWideDesktopNotification

In the interim, rwall is probably best for people not running X. For those running X it is going to be a bit more complicated to deliver a graphical message.

To deliver a graphical message, have your clients run xhost, and allow your remote connection to run local graphical applications. Then use xmessage or zenity or what ever you prefer.

See man xhost for details.

An alternate, more secure method would be to use xauth

http://zweije.home.xs4all.nl/xauth-6.html#ss6.2

edit flag offensive delete link more
0

answered 2011-11-21 06:44:51 +0000

asto gravatar image

updated 2011-11-21 07:13:15 +0000

Try notify-send

Edit: Turns out this doesn't exactly do what I thought it does! You will need individually ssh into each box you want to message with the -X option and message them individually. Probably will need to script a solution if you need to message a large number of computers. Worth filing a feature request for this one!

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Use your votes!

  • Use the 30 daily voting points that you get!
  • Up-vote well framed questions that provide enough information to enable people provide answers.
  • Thank your helpers by up-voting their comments and answers. If a question you asked has been answered, accept the best answer by clicking on the checkbox on the left side of the answer.
  • Down-voting might cost you karma, but you should consider doing so for incorrect or clearly detrimental questions and answers.

Question Tools

Follow
1 follower

Stats

Asked: 2011-11-21 06:24:02 +0000

Seen: 3,121 times

Last updated: Nov 28 '11