Ubuntu之systemd延时启动服务(六十七)

2024-05-07 20:32

本文主要是介绍Ubuntu之systemd延时启动服务(六十七),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

Ubuntu之systemd延时启动服务 

1.linux查看启动时间
#  systemd-analyze
Startup finished in 10.026s (firmware) + 3.578s (loader) + 3.124s (kernel) + 1min 30.350s (userspace) = 1min 47.079s
graphical.target reached after 14.855s in userspace
2.linux查看每个应用启动顺序和时间
#  systemd-analyze blame
8.648s vboxdrv.service7.746s plymouth-quit-wait.service5.297s NetworkManager-wait-online.service3.185s snap.lxd.activate.service1.381s snap-nmap-2280.mount1.379s snap-anbox\x2dinstaller-24.mount1.307s snap-fast-4.mount1.298s snap-atom-282.mount1.295s snap-gtk2\x2dcommon\x2dthemes-13.mount1.258s dev-nvme0n1p2.device1.142s snap-lxd-20806.mount1.131s snap-docker-796.mount1.055s snap-vlc-2344.mount1.027s snapd.service992ms snap-core-11187.mount942ms snap-pdftk-9.mount892ms snap-hexyl-25.mount868ms snap-core20-1026.mount777ms snap-audacity-857.mount774ms snap-snapd-12159.mount

3.应用和服务启动时间火焰图
# systemd-analyze plot  >  jupiter.example.com-startup.svg

 此图发现graphical.target图形服务是最后启动的,所以After在graphical.target之后启动.

4.列出active服务
# systemctlUNIT                                                                                             LOAD   ACTIVE     SUB       DESCRIPTION                                                                   proc-sys-fs-binfmt_misc.automount                                                                loaded active     running   Arbitrary Executable File Formats File System Automount Point                 dev-fuse.device                                                                                  loaded activating tentative /dev/fuse                                                                     sys-bus-pci-drivers-nvidia.device                                                                loaded active     plugged   /sys/bus/pci/drivers/nvidia                                                   sys-devices-pci0000:00-0000:00:02.0-drm-card0-card0\x2deDP\x2d1-intel_backlight.device           loaded active     plugged   /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight    sys-devices-pci0000:00-0000:00:14.0-usb1-1\x2d1-1\x2d1:1.0-net-enx00e04c3600fa.device            loaded active     plugged   RTL8152 Fast Ethernet Adapter                                                 sys-devices-pci0000:00-0000:00:14.0-usb1-1\x2d14-1\x2d14:1.0-bluetooth-hci0-hci0:256.device      loaded active     plugged   /sys/devices/pci0000:00/0000:00:14.0/usb1/1-14/1-14:1.0/bluetooth/hci0/hci0:256sys-devices-pci0000:00-0000:00:14.0-usb1-1\x2d14-1\x2d14:1.0-bluetooth-hci0.device               loaded active     plugged   
5.列出启动失败服务
# systemctl --failedUNIT                 LOAD   ACTIVE SUB    DESCRIPTION                               
● ipmiutil_wdt.service loaded failed failed ipmiutil Watchdog Timer Service using cron
● vboxdrv.service      loaded failed failed VirtualBox Linux kernel module

6.systemd延时启动test.service
# emacs /usr/lib/systemd/user/test.service
DefaultDependencies=no
Requires=dbus.service
#等待系统启动完成,再启动本服务
After=graphical.target[Service]
User=root
ExecStart=/usr/bin/test
Restart=always
RestartSec=1[Install]
#等待图形界面启动完成后,再安装
WantedBy=graphical.target

这篇关于Ubuntu之systemd延时启动服务(六十七)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/968310

相关文章

SpringBoot集成redisson实现延时队列教程

《SpringBoot集成redisson实现延时队列教程》文章介绍了使用Redisson实现延迟队列的完整步骤,包括依赖导入、Redis配置、工具类封装、业务枚举定义、执行器实现、Bean创建、消费... 目录1、先给项目导入Redisson依赖2、配置redis3、创建 RedissonConfig 配

RabbitMQ 延时队列插件安装与使用示例详解(基于 Delayed Message Plugin)

《RabbitMQ延时队列插件安装与使用示例详解(基于DelayedMessagePlugin)》本文详解RabbitMQ通过安装rabbitmq_delayed_message_exchan... 目录 一、什么是 RabbitMQ 延时队列? 二、安装前准备✅ RabbitMQ 环境要求 三、安装延时队

sysmain服务可以禁用吗? 电脑sysmain服务关闭后的影响与操作指南

《sysmain服务可以禁用吗?电脑sysmain服务关闭后的影响与操作指南》在Windows系统中,SysMain服务(原名Superfetch)作为一个旨在提升系统性能的关键组件,一直备受用户关... 在使用 Windows 系统时,有时候真有点像在「开盲盒」。全新安装系统后的「默认设置」,往往并不尽编

Ubuntu如何升级Python版本

《Ubuntu如何升级Python版本》Ubuntu22.04Docker中,安装Python3.11后,使用update-alternatives设置为默认版本,最后用python3-V验证... 目China编程录问题描述前提环境解决方法总结问题描述Ubuntu22.04系统自带python3.10,想升级

Python 基于http.server模块实现简单http服务的代码举例

《Python基于http.server模块实现简单http服务的代码举例》Pythonhttp.server模块通过继承BaseHTTPRequestHandler处理HTTP请求,使用Threa... 目录测试环境代码实现相关介绍模块简介类及相关函数简介参考链接测试环境win11专业版python

SpringBoot通过main方法启动web项目实践

《SpringBoot通过main方法启动web项目实践》SpringBoot通过SpringApplication.run()启动Web项目,自动推断应用类型,加载初始化器与监听器,配置Spring... 目录1. 启动入口:SpringApplication.run()2. SpringApplicat

Nginx中配置使用非默认80端口进行服务的完整指南

《Nginx中配置使用非默认80端口进行服务的完整指南》在实际生产环境中,我们经常需要将Nginx配置在其他端口上运行,本文将详细介绍如何在Nginx中配置使用非默认端口进行服务,希望对大家有所帮助... 目录一、为什么需要使用非默认端口二、配置Nginx使用非默认端口的基本方法2.1 修改listen指令

解决Nginx启动报错Job for nginx.service failed because the control process exited with error code问题

《解决Nginx启动报错Jobfornginx.servicefailedbecausethecontrolprocessexitedwitherrorcode问题》Nginx启... 目录一、报错如下二、解决原因三、解决方式总结一、报错如下Job for nginx.service failed bec

SysMain服务可以关吗? 解决SysMain服务导致的高CPU使用率问题

《SysMain服务可以关吗?解决SysMain服务导致的高CPU使用率问题》SysMain服务是超级预读取,该服务会记录您打开应用程序的模式,并预先将它们加载到内存中以节省时间,但它可能占用大量... 在使用电脑的过程中,CPU使用率居高不下是许多用户都遇到过的问题,其中名为SysMain的服务往往是罪魁

Spring Boot项目如何使用外部application.yml配置文件启动JAR包

《SpringBoot项目如何使用外部application.yml配置文件启动JAR包》文章介绍了SpringBoot项目通过指定外部application.yml配置文件启动JAR包的方法,包括... 目录Spring Boot项目中使用外部application.yml配置文件启动JAR包一、基本原理