Broadcast to all users on Linux
Written by Guillermo Garron
Date: 2008-11-15 10:36:30 00:00
Sometimes as the administrator of a Linux Operating System Server, y may need to send a message to all users in a multi-user system.
There are some different ways to do this, but we will now see just one of them.
We will use wall
As the main input of wall is a file, we will first create our message file.
Let’s say you want to tell users that in two more ours the main SQL database is going to be unavailable because of maintenance.
So type:
echo 'Please note that in two more hours, and for one hour, you will not be able to use the SQL database, please save all your job before, and quit any application using it'> message.txt
OK, now we have our message ready, it is time to send it to the users.
wall < message.txt
And something like this will appear on all terminals open.
Broadcast Message from root@debian (/dev/pts/3) at 9:56
…
Please note that in two more hours, and for one hour, you will not be able to use the SQL database, please save all your job before, and quit any application using it