Introduction | As a system administrator, before you shut down a server, you may want to send a message to warn them that the system is about to shut down. By default, the shutdown command will broadcast information to other system users. |
In a previous article, we explained the differences between shutdown, poweroff, halt, and reboot commands in Linux and revealed what they actually do when executing these commands with different options.
This article will show you how to send a customized message to all system users when the system is shut down.
Suggested reading: tuptime - Displays the historical and statistical running time of a Linux system.
As a system administrator, before you shut down a server, you may want to send a message to warn them that the system is about to shut down. By default, the shutdown command will broadcast this message to other system users as follows:
# shutdown 13:25
Linux shutdown operation broadcast message
Shutdown scheduled for Fri 2017-05-12 13:25:00 EAT, use 'shutdown -c' to cancel. Broadcast message for root@tecmint (Fri 2017-05-12 13:23:34 EAT): The system is going down for power-off at Fri 2017-05-12 13:25:00 EAT!
To send a custom message to other system users on the shutdown line, run the following command. In this example, shutdown occurs two minutes after the command is executed.
# shutdown 2 The system is going down for required maintenance. Please save any important work you are doing now!
Suppose you have some critical system operations, such as scheduled system backups or updates, that will be performed while the system is shut down, as shown below, you can use the -c option to cancel the shutdown and continue after performing these operations:
# shutdown -c
Linux shutdown operation cancellation message:
Shutdown scheduled for Fri 2017-05-12 14:10:22 EAT, use 'shutdown -c' to cancel. Broadcast message for root@tecmint (Fri 2017-05-14 :10:27 EAT): The system shutdown has been cancelled at Fri 2017-05-12 14:11:27 EAT!
Also, learn how to use simple and traditional methods in Linux: automatically execute commands/scripts on reboot or boot.
Now you know how to send a custom message to other system users before the system shuts down. Do you have any other thoughts you’d like to share on this topic?
The above is the detailed content of How to send custom messages to other system users in Linux and close the messages sent to them before. For more information, please follow other related articles on the PHP Chinese website!