Let's look at how to boot reboot and shut down Linux systems safely
to reboot or shut down a Linux machine. We'll often use the system CTL command
which is short for system control.
Now, some commands require system administrator privileges.
The root user has such privileges so we can
reboot a machine simply by typing system CTL reboot.
Now, regular users cannot use commands that change the system state
rarely.
You might find yourself in situations where the
system refuses to reboot or shut down.
Normally,
that might be because some program is misbehaving
or it's stuck in some way and it just does not wanna close properly.
In such situations, you can force close all programs and reboot in a more abrupt way.
Now, this isn't recommended to do unless it's absolutely necessary
or
pseudo systems CTL power off dash dash force.
Now, if not even this works, you can specify force twice.
And this is one that you only use as a last resort.
This is exactly like pressing the reset button,
the system reboots instantly and programs have no
chance to close properly or save their data.
And this is exactly like unplugging a computer from its power source.
You'll often find that you need to reboot some servers in the middle of the night,
say two or 3 a.m.
and it's inconvenient to have to wake up just to reboot some device
so you can instead instruct Linux to do this on its own.
The shutdown command is better suited for scheduled reboots or shutdowns
to shut down at 2 a.m.
You would type in this
and the time is in a 24 hour format. So you can use anything between 0000 and 2359.
Now, if you want to shut down X minutes later,
use plus X instead where X is the value
to shut down after 15 minutes, this is what you would type in
and to reboot instead add the dash R reboot option.
And you can also set what is called a wall message.
If a few users are logged into this Linux machine,
the wall message will be shown to them before the server reboots or shuts down.
This gives them a chance to know in advance
why and when the machine will become unavailable,
it also gives them a chance to finish their work before this
happens instead of abruptly being disconnected
while having no idea what happened.
And you can write your wall message like this
in between the single quotes
and right here it says scheduled restart to upgrade our Linux kernel
and that is rebooting and shutting down Linux