LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   How to broadcast a message to all user's. (https://www.linuxquestions.org/questions/slackware-14/how-to-broadcast-a-message-to-all-users-99634/)

Tarts 10-02-2003 08:55 PM

How to broadcast a message to all user's.
 
Hello!

I would like to broadcast a messsage to all user's on any terminal's.
I've looked into 'talk' and 'write', I was looking for something similar the way shutdown work's: 'shutdown -r now "The system is going for a reboot"'

Any advise on a way to accomplish this goal of mine?

Thank you, Tarts.

xdrainox 10-02-2003 08:57 PM

#> echo put your message here >> file.txt
#> wall file.txt

I dont know if theres any other options.. man wall.

Tarts 10-02-2003 09:24 PM

Quote:

Originally posted by xdrainox
#> echo put your message here >> file.txt
#> wall file.txt

I dont know if theres any other options.. man wall.

Thank's alot!

Allow me to show you the result's:

Code:

#!/bin/bash
MODTIME=/var/log/modfile
TMP=tmp

find / -mtime 2 -o ctime 2 &> $MODTIME
echo 1> /dev/null
echo "Mirrus: Check '/var/log/modfile'." &> $TMP
wall $TMP
rm $TMP
exit 0

Next learn 'crond' and have it run on specified interval's!

Thank's!

Azmeen 10-03-2003 01:50 AM

I thought you can straight away wall on the command line...

ie: wall Hey you people!!!

dalek 10-03-2003 02:48 AM

Mine did
 
It worked on mine in Mandrake 9.1.

[root@smoker dale]# wall "hey you people"
[root@smoker dale]#
Broadcast message from root (pts/1) (Fri Oct 3 02:43:04 2003):

hey you people

[root@smoker dale]#


he he he he he he. I learned something new. :D

Thanks.

:D :D :D :D :D

micxz 10-03-2003 03:22 AM

My experiences:

micxz@mars:~> wall message.txt
wall: will not read message.txt - use stdin.
micxz@mars:~> cat message.txt | wall

Broadcast Message from micxz@mars
(/dev/pts/4) at 1:21 ...

Hello'
This is a cool thing you can do;

Works nice;
also:

micxz@mars:~> wall
testing typing now cntrl-D twice fast;

Broadcast Message from micxz@mars
(/dev/pts/4) at 1:21 ...
testing typing now cntrl-D twice fast;

Works also;

ehdwuld 10-03-2003 03:27 AM

freeBSD wont let me wants a
<group> <filename>

Tarts 10-03-2003 09:21 AM

Quote:

Originally posted by Azmeen
I thought you can straight away wall on the command line...

ie: wall Hey you people!!!

This does not work on my system, wall need's a file, by default it supposed to read from 'stdin', but this does not work, i'm sure there's a way to redirect or something....

{edit}

#wall
Hello!

then type ctrl d
{edit2}

#echo "Hello users, the date is `date`" | wall

msmi10 09-28-2010 06:10 PM

On my Ubuntu 10.04 I use something like:
echo Please log off now!!! | wall

dalek 09-28-2010 06:21 PM

Quote:

Originally Posted by msmi10 (Post 4111953)
On my Ubuntu 10.04 I use something like:
"Please log off now!!!" | wall

Wow! You dug deep to find this old thread. It's only 7 years old. :D

:) :)

GazL 09-28-2010 06:26 PM

1) Why are you resurrecting a 7 year old thread?

2) You didn't even get the command right! You'd end up getting a "Please log off now" command not found, doing that!

Not exactly an auspicious first post.

ehdwuld 09-30-2010 08:57 PM

I had forgotten I even had a membership here
dang

zombie thread

WilliamS 10-02-2010 12:10 PM

First, stop the apostrophe abuse...

aggravatedgestalt 01-12-2011 07:40 PM

Quote:

Originally Posted by GazL (Post 4111960)
1) Why are you resurrecting a 7 year old thread?

2) You didn't even get the command right! You'd end up getting a "Please log off now" command not found, doing that!

Not exactly an auspicious first post.

Gee wiz dude! I am glad that fellow actually posted that. With quotation marks it almost works; but I haven't seen anyone post a good answer yet. Is this an unauspicious first post too? And, the essential CLI should still apply even 7 years later, no?

dalek 01-12-2011 09:14 PM

Quote:

Originally Posted by aggravatedgestalt (Post 4222356)
Gee wiz dude! I am glad that fellow actually posted that. With quotation marks it almost works; but I haven't seen anyone post a good answer yet. Is this an unauspicious first post too? And, the essential CLI should still apply even 7 years later, no?

This works here:

Code:

wall -n "please log off now"
It even does a pop up in KDE4. One of those "notify" thingys. lol

:D :D

GazL 01-13-2011 05:24 AM

The wall command in Slackware (at least in Slackware Current) is from util-linux-ng 2.18 and doesn't appear to support the -n option. Perhaps the gentoo one is from a different origin or version.


There's plenty of ways of doing this though,

msmi10 has since modified his code example above to something that should work (though it'd be better with quotes) so I'm not sure why there was a need to resurrect this thread once again. Resurrecting long dead threads wastes everyone's time and is annoying when you don't spot it is a zombie. Reading back I was clearly overly harsh with him, I guess I wasn't in a very tolerant mood that day (Everyone has bad days).

In the hopes of finally laying this one to rest, I'll just finish with another couple of possibilities.
In recent bash versions, you can use the syntax
Code:

wall <<< "Never argue with an idiot. They drag you down to their level and then beat you with experience."
More portably, you can use a here-document, which also has the advantage of allowing you to do a few other fancy things like pre-formatting, or include variables
and command substitutions
Code:

wall <<_EOF
Some text here
    and here's some indented
    and today's date is $(date)
and so on.
_EOF

or, as has already been mentioned you can just take the input from the output of another command in the more usual pipe syntax, as per the now corrected example msmi10 posted.

dalek 01-13-2011 05:40 AM

Quote:

Originally Posted by GazL (Post 4222758)
The wall command in Slackware (at least in Slackware Current) is from util-linux-ng 2.18 and doesn't appear to support the -n option. Perhaps the gentoo one is from a different origin or version.

Here, it works even without the -n option. On Gentoo, that command is part of sysvinit-2.88-r1. So, there is no telling what sort of differences there is between Gentoo and Slackware.

:D :D

GazL 01-13-2011 05:59 AM

Quote:

Originally Posted by dalek (Post 4222770)
Here, it works even without the -n option. On Gentoo, that command is part of sysvinit-2.88-r1. So, there is no telling what sort of differences there is between Gentoo and Slackware.

:D :D

:) There are one or two commands that seem to be differ between distros: 'rename' is another one that I find differs.
Having said that, basic 'wall' usage is that simple I'm surprised anyone could manage to have a problem using it.

Anyway, old thread and really not worth labouring over. Thanks for posting dalek.

dalek 01-13-2011 06:02 AM

Quote:

Originally Posted by GazL (Post 4222785)
:) There are one or two commands that seem to be differ between distros: 'rename' is another one that I find differs.
Having said that, basic 'wall' usage is that simple I'm surprised anyone could manage to have a problem using it.

Anyway, old thread and really not worth labouring over. Thanks for posting dalek.

Yea but it did remind me to update my sig with the new and improved rig.

:D :D

unclejed613 01-13-2011 08:23 AM

this works for me in slack 13 (i think i asked this question in another thread...)

Code:

wall {enter}
type whatever message you want here
it can even be several lines
because wall will send all it when you hit
{control} d


GazL 01-13-2011 08:37 AM

On reflection, I think all the confusion over this is a BSD v SYSV issue.

Slackware appears to use the bsd syntax
wall [file]

Other distros (Gentoo being one from what dalek said above) use a SYSV syntax
wall [message text]

However, both versions will accept input on stdin.

unclejed613 01-13-2011 05:39 PM

ah-ha.... i did a "man wall" and the manpage says:
Code:

WALL(1)                  BSD General Commands Manual                  WALL(1)

NAME
    wall -- write a message to users

SYNOPSIS
    wall [file]

DESCRIPTION
    Wall displays the contents of file or, by default, its standard input, on
    the terminals of all currently logged in users.

    Only the super-user can write on the terminals of users who have chosen
    to deny messages or are using a program which automatically denies mes-
    sages.

    Reading from a file is refused when the invoker is not superuser and the
    program is suid or sgid.

SEE ALSO
    mesg(1), talk(1), write(1), shutdown(8)

HISTORY
    A wall command appeared in Version 7 AT&T UNIX.

AVAILABILITY
    The wall command is part of the util-linux-ng package and is available
    from ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/.

Linux 0.99                      March 8, 1993                      Linux 0.99
~

so yes, Slack uses the BSD wall, but the manpage really doesn't go into the details of the stdin input usage.

gee... from looking at the manpage for talk, it looks like talk could be used as a basic IM on a local network... i'll have to play with it a bit

dalek 01-13-2011 05:49 PM

Mine says it was written by Miquel van Smoorenburg and at the top says "Linux User's Manual". It appears that Gentoo uses something entirely different. Sort of wonder why they didn't name it something different too. Maybe gwall or something if it is only used on Gentoo.

:D :D

Nille_kungen 01-13-2011 07:38 PM

Reading this thread i saw that the command first posted used ! so using " " won't work.
So use ' ' instead.
Code:

echo 'Please log off now!!!' | wall
or
Code:

wall <<< 'Please log off now!!!'
Or to play some more.
Code:

wall <<< 'Who want'\''s lunch?'
Code:

wall <<< "Who want"\'"s lunch?"
But i almost feel ashamed answering in this old thread.

Lunar 07-09-2012 01:18 AM

Quote:

Originally Posted by Nille_kungen (Post 4223643)
Reading this thread i saw that the command first posted used ! so using " " won't work.
So use ' ' instead.
Code:

echo 'Please log off now!!!' | wall
But i almost feel ashamed answering in this old thread.

Thank You.. Finally code that actually works!

Landis.

Flashwalker 02-11-2014 02:44 AM

wall absolutly doesn't broadcast anything on Ubuntu 12.04, when using by root or by user.
Works only via ssh and doesn't support cyrillic.

ponce 02-11-2014 02:52 AM

maybe that's why this topic is in the Slackware forum, not the Ubuntu one.

if you have questions/reports about the usage of wall on Ubuntu, open a topic on the dedicated forum, don't revive an old thread on random ones (if you had read all this one you could have seen this -the awkward reviving- already happened in this same thread).

brianL 02-11-2014 04:11 AM

Drive a stake through this thread's heart.

Flashwalker 02-12-2014 11:28 PM

1 Attachment(s)
Quote:

Originally Posted by ponce (Post 5115387)
have seen this -the awkward reviving-

Attachment 14740

randomjedi 05-12-2015 06:06 PM

I'm glad this thread still exists.
 
I joined just to say I use your site all the time and finding threads even as old as 2003 and having users still replying to them in 2015 and beyond shouldn't upset people because they're 'old'. This information is still useful, even today. Isn't that the point of a forum like this? :p

ANYWAY, I found the information on wall <<< "text here" useful, so thanks! :D

deadthread123 01-09-2018 12:14 PM

Quote:

Originally Posted by Tarts (Post 514384)
Hello!

I would like to broadcast a messsage to all user's on any terminal's.
I've looked into 'talk' and 'write', I was looking for something similar the way shutdown work's: 'shutdown -r now "The system is going for a reboot"'

Any advise on a way to accomplish this goal of mine?

Thank you, Tarts.

Hi Tarts

I hope you're doing well. Apologies for delay in replying.

Did you try using the below command to find out the right syntax?

Code:

man wall

Didier Spaier 01-09-2018 12:23 PM

@deadthread123: so you are bored enough to answer someone whose last post dates back nearly 14 years ago???

deadthread123 01-09-2018 12:24 PM

Quote:

Originally Posted by Didier Spaier (Post 5804266)
@deadthread123: so you are bored enough to answer someone whose last post dates back nearly 14 years ago???

Why not? He still might be on the look out for the right answer.

Didier Spaier 01-09-2018 12:51 PM

He got the right answer answer in post #2 and confirmed that it worked on post #3, more that 14 years ago.

Next time, please read previous answers before posting yours.

Welcome to this forum anyway.


All times are GMT -5. The time now is 01:24 AM.