wall doesn't broadcast to GUI terminals on 16.04

The title sums it up. Running wall <<< "TEST" shows the message in any TTY but not in any GUI terminals ( tested with gnome-terminal and sakura ).

I have several battery and temperature monitoring scripts that rely on walling a message and after recent upgrade to 16.04 I've noticed they stopped working in GUI.

I can't determine whether this is a bug or something is preventing the messages from being displayed in GUI.

How should I proceed ?

Additional info:

Running byobu in a gui terminal does allow seeing wall messages


Solution 1:

Due to the way gnome-terminal works, wall does not register it as a terminal. A more thorough explanation can be found here. I assume that the same is true for sakura.

Based on Stancu Mihai's answer, I have created a script which mimics the way wall usually works, including the banner with user name and timestamp (use -n or --nobanner to remove the banner). The script does not currently support reading the message from a file.

You can replace the normal wall command with this one by adding an alias in ~/.bashrc:

echo 'alias wall="~/your/path/to/wall.sh"' >> ~/.bashrc

Example usage:

$ wall "some message"

Broadcast message from username@hostname (pts/19) (Wed Mar 29 11:07:35 2017):

some message

$ wall -h

Usage:
 wall [options] [message]

Write a message to all users.

Options:
 -n, --nobanner          do not print banner
 -h, --help              display this help and exit

Solution 2:

Yes it true that gnome-terminal it doesn't update login records, en because of that i try to figure out another solution:

  1. Let's find out all active pseudo terminals
ps -ef | grep " pts/" | awk '{print $6}' | sort -u | tee terminals4message.txt

This helps you to list all desktop terminal sessions.

Another way to send a message to active desktop terminal sessions

echo "$MESSAGE_to_send" | sudo tee /dev/pts/$terminal_number
  1. Don't forget about tty sesions
ps -ef | grep " tty" | awk '{print $6}' | sort -u | grep -v "pts" | tee terminals4message.txt

This helps you to list all pty sessions

  1. Sending the message to all
cat terminals4message.txt | while read TTY_TO; do echo -e "SYSTEM MESAGE: $(date) - \n MESAJ" | sudo tee /dev/$TTY_TO 1>/dev/null
  1. Now let's put it all together You can create a nice script to replace your current wall app and integrate the all above things.
    After that you can add to your ~/.bashrc alias wall="your_wall_replacement.sh" In this way you don't need to delete the current wall

Sorry if something is not right, as somebody didn't let me focus on this subject...if you guys notice something odd please leave a comment.

10x