How to broadcast a message to all users in Linux

1950阅读 0评论2013-04-08 zhangzheyuk
分类:其他平台

Sometimes as the administrator of a Linux Operating System Server, you may need to send a message to all users. There are some different ways to do this, and now we will 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.

For example: you want to tell users that in two more hours 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                                              
        (/dev/pts/3) at 9:56 ...                                               
                                                                               
Please note that in two more hours, and for one hour, you will not be able to u
se the SQL database, please save all your job before, and quit any application 
using it.

More, you can use pipe to implement it, which is the left job to you.


 转自 http://lichengwulove.blog.163.com/blog/static/846483112010101415916297/

上一篇:在使用jekyll的时候遇到的Git命令
下一篇:关于cp