我尝试过

我尝试过

我今天一直在调整我的启动速度。第一步是删除:

      6.194s NetworkManager-wait-online.service

为了删除它我使用了:

systemctl disable NetworkManager-wait-online.service

现在我的启动时间显示:

$ systemd-analyze
Startup finished in 3.407s (kernel) + 8.356s (userspace) = 11.764s

网络仍然运行正常,因此看来这一改变并未带来任何损害。

接下来systemd-analyze blame是:

      5.467s udev-configure-printer@-devices-pci0000:00-0000:00:14.0-usb3-3\x2d3-3\x2d3.1.service

我每个月只使用打印机几次,在启动阶段肯定不需要它。我的问题是:如何将 CUPS 初始化从启动顺序移到启动后环境中,例如启动应用程序或者/etc/rc.local其他有意义的地方?

或者可以告诉 systemd 在登录屏幕出现后加载服务吗?或者告诉它只需等待 15 秒再加载服务?


我尝试过

使用说明这里我将目标设置为登录提示之后。我通过编辑来实现这一点,/lib/systemd/system/udev-configure-printer.service如下所示:

[Unit]
Description=Automatic USB/Bluetooth printer setup (%i)
# July 29, 2017 - Move from startup (5 seconds time) to after login screen
After=lightdm.service

[Service]
#Type=simple
Type=forking
GuessMainPID=true
ExecStart=/lib/udev/udev-configure-printer add %I
# This ExecStop would be useful to disable the print queue when ippusbxd
# crashes or gets killed, but in the case that ippusbxd does not get started
# at all during the process run by ExecStart (printer does not support
# IPP-over-USB) ExecStop gets run immediately making a printer getting
# disabled again right after it getting enabled or set up
# ExecStop=/lib/udev/udev-configure-printer remove %I

即使重启两次以确认速度后,启动时间也从 11 秒增加到 16 秒。

相关内容