Ubuntu Unleashed 2019 Edition: Covering 18.04, 18.10, 19.04

(singke) #1

To incorporate a timed shutdown and a pertinent message to all active users,
use shutdown’s time and message options, as follows:


Click here to view code image
matthew@seymour:~$ sudo shutdown -h 18:30 "System is going down for
maintenance this evening at 6:30 p.m. Please make sure you have saved
your work and logged out by then or you may lose data."


This example shuts down your system and provides a warning to all active
users 15 minutes before the shutdown (or reboot). Shutting down a running
server can be considered drastic, especially if there are active users or
exchanges of important data occurring (such as a backup in progress). One
good approach is to warn users ahead of time. This can be done by editing the
system Message of the Day (MOTD) motd file, which displays a message to
users when they log in using the command-line interface, as is common on
multiuser systems.


It used to be that to create a custom MOTD file, you only had to use a text
editor and change the contents of /etc/motd. However, this has changed in
Ubuntu, as the developers have added a way to automatically and regularly
update some useful information contained in the MOTD file by using cron.
To modify how the MOTD file is updated, you should install update-motd
and read the man page.


You can also make downtimes part of a regular schedule, perhaps to coincide
with security audits, software updates, or hardware maintenance.


You should shut down Ubuntu for only a few very specific reasons:


    You are not using   the computer,   no  other   users   are logged  in  or  expected
to need or use the system (as with your personal desktop or laptop
computer), and you want to conserve electrical power.
You need to perform system maintenance that requires any or all system
services to be stopped.
You want to replace integral hardware.
TIP
Do not shut down your computer if you suspect that intruders have
infiltrated your system; instead, disconnect the machine from any or all
networks and make a backup copy of your hard drives. You might want to
also keep the machine running to examine the contents of memory and to
examine system logs. Exceptions to this are when the system contains only
trivial data files and nonessential services, such as a personal computer that
is only used to run a web browser, and when you have no intention of trying
Free download pdf