还有部分 graphical.target的日志:
[ 19.436815] testvm1.both.org systemd[1]: Starting My hello shell script...[ 19.437070] testvm1.both.org systemd[1]: Starting IPv4 firewall with iptables...[ 19.612614] testvm1.both.org hello.sh[841]: ###############################[ 19.612614] testvm1.both.org hello.sh[841]: ######### Hello World! ########[ 19.612614] testvm1.both.org hello.sh[841]: ###############################[ 19.629455] testvm1.both.org audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=hello comm=systemd exe=/usr/lib/systemd/systemd hostname=? addr=? terminal=? res=success'[ 19.629569] testvm1.both.org audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=hello comm=systemd exe=/usr/lib/systemd/systemd hostname=? addr=? terminal=? res=success'[ 19.629682] testvm1.both.org systemd[1]: hello.service: Succeeded.[ 19.629782] testvm1.both.org systemd[1]: Finished My hello shell script.尽管单元文件的 WantedBy部分包含了graphical.target,hello.service单元在启动后大约 19.5 或 19.6 秒后运行 。但是hello.service在multi-user.target中开始于 17.24 秒,在graphical target中开始于 19.43 秒 。
这意味着什么呢?看看 这个链接 。文件内容显示 systemd 先启动了默认目标
/etc/systemd/system/default.targetgraphical.target,然后graphical.target触发了multi-user.target 。
[root@testvm1 system]# cat default.target# SPDX-License-Identifier: LGPL-2.1+## This file is part of systemd.## systemd is free software; you can redistribute it and/or modify it# under the terms of the GNU Lesser General Public License as published by# the Free Software Foundation; either version 2.1 of the License, or# (at your option) any later version.[Unit]Description=Graphical InterfaceDocumentation=man:systemd.special(7)Requires=multi-user.targetWants=display-manager.serviceConflicts=rescue.service rescue.targetAfter=multi-user.target rescue.service rescue.target display-manager.serviceAllowIsolate=yes[root@testvm1 system]#不管是用 graphical.target还是multi-user.target启动服务,hello.service单元都在启动后的 19.5 或 19.6 秒后启动 。基于这个事实和日志结果(特别是使用单调输出的日志),你就知道这些目标是在并行启动 。再看看日志中另外一件事:
[ 28.397330] testvm1.both.org systemd[1]: Reached target Multi-User System.[ 28.397431] testvm1.both.org systemd[1]: Reached target Graphical Interface.两个目标几乎是同时完成的 。这是和理论一致的,因为 graphical.target触发了multi-user.target,在multi-user.target到达(即完成)之前它是不会完成的 。但是hello.service比这个完成的早的多 。
这一切表明,这两个目标几乎是并行启动的 。如果你查看日志,你会发现各种目标和来自这类主要目标的服务大多是平行启动的 。很明显,
推荐阅读
- 自来水总硬度的测定注意事项
- Linux使用虚拟机安装Windows 10的方法
- 如何在Linux上安装和使用Makeself
- Linux如何安装使用pidstat命令
- Linux如何使用setfacl命令创建权限文件
- Ubuntu使用SHA256检验iso镜像完整性的实例
- iphone xs max使用技巧 iphone xs max技巧有哪些
- 如何使用电视观看电视台直播
- 怎么缝衣服才能将线藏起来
- 学会使用粉饼
