我启用了非静默引导,我想知道如何才能简单地启动服务的实名,而不是这样:
[Started] Manage, install and generate color profile我真的很讨厌在linux上对我隐藏的东西,它怎么能显示出来:
[Started] service colord显然,这个只是一个例子,我只想打印已启动的服务名称,而不是它的描述,而不激活超硬详细的调试信息(如果可能的话)。
发布于 2018-07-13 17:02:13
注意:这展示了如何调整systemd的日志级别并获取有关服务名称的更多细节。
要确定systemd的日志级别,可以使用以下命令:
$ systemctl -pLogLevel show
LogLevel=debug你可以这样改变它:
$ systemd-analyze set-log-level notice
$ systemctl -pLogLevel show
LogLevel=notice各级情况如下:
--log-level=
Set log level. As argument this accepts a numerical log level or the
well-known syslog(3) symbolic names (lowercase): emerg, alert, crit,
err, warning, notice, info, debug.要使它在重新启动之间永久化,您可以在systemd的配置文件中编辑它:
$ grep LogLevel /etc/systemd/system.conf
#LogLevel=info或者通过/etc/default/grub文件对GRUB_CMDLINE_LINUX和GRUB_CMDLINE_LINUX_DEFAULT的定义来设置它。
GRUB_CMDLINE_LINUX="console=tty1 console=ttyS0,115200n8 earlyprintk=ttyS0,115200 rootdelay=300 net.ifnames=0 quiet loglevel=5 rd.systemd.show_status=auto systemd.log_level=debug"
GRUB_CMDLINE_LINUX_DEFAULT="console=tty1 console=ttyS0,115200n8 earlyprintk=ttyS0,115200 rootdelay=300 net.ifnames=0 quiet loglevel=5 rd.systemd.show_status=auto systemd.log_level=debug"然后重建您的initramfs:
$ grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-693.21.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-693.21.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-1ec1e304541e429e8876ba9b8942a14a
Found initrd image: /boot/initramfs-0-rescue-1ec1e304541e429e8876ba9b8942a14a.img
done当该级别设置为debug时,来自systemd的消息如下所示:
$ journalctl -b | less
Jul 13 12:06:44 centos7 systemd[1]: Activating default unit: default.target
Jul 13 12:06:44 centos7 systemd[1]: Trying to enqueue job initrd.target/start/isolate
Jul 13 12:06:44 centos7 systemd[1]: Installed new job local-fs.target/start as 20
Jul 13 12:06:44 centos7 systemd[1]: Installed new job systemd-udev-trigger.service/start as 18
Jul 13 12:06:44 centos7 systemd[1]: Installed new job systemd-udevd-control.socket/start as 8
Jul 13 12:06:44 centos7 systemd[1]: Installed new job remote-fs.target/start as 38
Jul 13 12:06:44 centos7 systemd[1]: Installed new job sysroot.mount/start as 31
Jul 13 12:06:44 centos7 systemd[1]: Installed new job swap.target/start as 17
Jul 13 12:06:44 centos7 systemd[1]: Installed new job kmod-static-nodes.service/start as 21
Jul 13 12:06:44 centos7 systemd[1]: Installed new job slices.target/start as 26
Jul 13 12:06:44 centos7 systemd[1]: Installed new job systemd-journald.service/start as 9
Jul 13 12:06:44 centos7 systemd[1]: Installed new job initrd-root-fs.target/start as 30
Jul 13 12:06:44 centos7 systemd[1]: Installed new job systemd-tmpfiles-setup-dev.service/start as 19
Jul 13 12:06:44 centos7 systemd[1]: Installed new job paths.target/start as 27
Jul 13 12:06:44 centos7 systemd[1]: Installed new job initrd.target/start as 1
Jul 13 12:06:44 centos7 systemd[1]: Installed new job initrd-fs.target/start as 42
...
...
Jul 13 12:06:44 centos7 systemd[1]: dracut-pre-udev.service: cgroup is empty
Jul 13 12:06:44 centos7 systemd[1]: ConditionPathIsReadWrite=/sys succeeded for systemd-udevd.service.
Jul 13 12:06:44 centos7 systemd[1]: About to execute: /usr/lib/systemd/systemd-udevd
Jul 13 12:06:44 centos7 systemd[1]: Forked /usr/lib/systemd/systemd-udevd as 226
Jul 13 12:06:44 centos7 systemd[1]: systemd-udevd.service changed dead -> start
Jul 13 12:06:44 centos7 systemd[1]: Starting udev Kernel Device Manager...
Jul 13 12:06:44 centos7 systemd[1]: Got cgroup empty notification for: /system.slice/dracut-pre-udev.service
Jul 13 12:06:44 centos7 systemd[1]: dracut-pre-udev.service: cgroup is empty
Jul 13 12:06:44 centos7 systemd[226]: Executing: /usr/lib/systemd/systemd-udevd
Jul 13 12:06:44 centos7 systemd-udevd[226]: ctrl=4 netlink=3您可以在上面的输出中清楚地看到服务的名称,例如。systemd-journald.service。
https://unix.stackexchange.com/questions/455132
复制相似问题