为什么关机时间不同?

Zan*_*nna 9 shutdown mate

我总是以完全相同的方式关闭我的 Ubuntu MATE 16.04 系统:我一直点击alt+F4直到我到达最后一个终端窗口并且所有其他应用程序都已退出,然后我输入poweroff

尽管我的程序具有一致性,但系统完全关闭所用的时间(即我正在观看启动画面的时间)差异很大,从大约 3 秒到大约 25 秒不等。为什么会发生这种情况,或者我如何知道?

我知道我可以阅读日志,但我想了解一些有关如何分析的提示

wal*_*tor 6

来自man 8 shutdown

   Once  TIME  has elapsed, shutdown sends a request to the init(8) daemon
   to bring the system down into the appropriate runlevel.

   This is performed by emitting the runlevel(7) event, which includes the
   new  runlevel  in  the  RUNLEVEL  environment  variable  as well as the
   previous runlevel (obtained from the environment or from /var/run/utmp)
   in  the  PREVLEVEL  variable.   An additional INIT_HALT variable may be
   set, this will contain the value HALT when bringing the system down for
   halt and POWEROFF when bringing the system down for power off.
Run Code Online (Sandbox Code Playgroud)

然后,每个守护进程都会识别 RUNLEVEL 中的更改,并采取适当的措施。这可以是从快速exit到配置保存到缓存刷新甚至整个数据库冻结的任何事情。

取决于您为每个守护程序设置的日志记录级别。您可能会在/var/log/*和 的子目录中看到一些信息/var/log/