At intervals, becoming more frequent as apocalypse approaches and starting at ten hours before shutdown, warning messages are displayed on the terminals of all users logged in. Five minutes before shutdown, or immediately if shutdown is in less than 5 minutes, logins are disabled by creating
/etc/nologin and copying the warning message there. If this file exists when a user attempts to log in,
login(1) prints its contents and exits. The file is removed just before
shutdown exits.
At shutdown time, a message is written in the system log containing the time of shutdown, who initiated the shutdown, and the reason. Next a message is printed announcing the start of the system shutdown hooks. Then the shutdown hooks in
/etc/rc.shutdown are run, and a message is printed indicating that they have completed. After a short delay,
shutdown runs
halt(8) or
reboot(8), or sends a terminate signal to
init(8) to bring the system down to single-user mode, depending on the choice of options.
The time of the shutdown and the warning message are placed in
/etc/nologin and should be used to tell the users why the system is going down, when it will be back up, and to share any other pertinent information.