Shutting down with systemctl
Shutting down a systemd system is really easy, but there are a few options that you might not know about. Let's start with the basic command to shut down and power off a machine, which looks like this:
donnie@ubuntu20-04:~$ sudo systemctl poweroff
So, what exactly is happening here? If you open the systemctl
man page and scroll down to the poweroff
item, you'll see that this command starts poweroff.target
, which looks like this:
[Unit] Description=Power-Off Documentation=man:systemd.special(7) DefaultDependencies=no Requires=systemd-poweroff.service After=systemd-poweroff.service AllowIsolate=yes JobTimeoutSec=30min JobTimeoutAction=poweroff-force [Install] Alias=ctrl-alt-del.target
In the [Unit]
section, you see that this requires systemd-poweroff.service
, which means that this service will now get started. At the bottom of the [Unit]
section, you will see two new parameters. The JobTimeoutSec=30min
line gives systemd plenty of time...