首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >什么能真正触发系统目标单元(如suspend.target )的活动状态?

问什么能真正触发系统目标单元(如suspend.target )的活动状态?
EN

Ask Ubuntu用户
提问于 2022-10-08 22:00:15
回答 2查看 250关注 0票数 1

我有一台服务器,显然是随机进入睡眠状态,我无法在系统日志中找出究竟是什么触发了这个状态。

因此我的问题是:什么进程(Es)或事件(S)能够在Ubuntu22.04上实际触发以下systemd目标进入active状态(例如使系统进入睡眠状态)的状态?

代码语言:javascript
复制
$ systemctl status suspend.target 
○ suspend.target - Suspend
     Loaded: loaded (/lib/systemd/system/suspend.target; static)
     Active: inactive (dead)
       Docs: man:systemd.special(7)
EN

回答 2

Ask Ubuntu用户

发布于 2022-10-08 22:43:24

那会是

代码语言:javascript
复制
systemctl enable suspend.target 

请注意,如果系统服务有故障,enable将出错,并将显示如下:

代码语言:javascript
复制
$ systemctl enable suspend.target 
The unit files have no installation config (WantedBy=, RequiredBy=, Also=,
Alias= settings in the [Install] section, and DefaultInstance= for template
units). This means they are not meant to be enabled using systemctl.
 
Possible reasons for having this kind of units are:
• A unit may be statically enabled by being symlinked from another unit's
  .wants/ or .requires/ directory.
• A unit's purpose may be to act as a helper for some other unit which has
  a requirement dependency on it.
• A unit may be started when needed via activation (socket, path, timer,
  D-Bus, udev, scripted systemctl call, ...).
• In case of template units, the unit is meant to be enabled with some
  instance name specified.

如果是的话.这个问题需要第一次解决。

票数 1
EN

Ask Ubuntu用户

发布于 2022-10-09 00:53:09

从我所看到的是节约能源触发了它。在阅读man systemd.special时,您可以看到suspend.target拉入sleep.target,并在需要时被调用。

代码语言:javascript
复制
   suspend.target
       A special target unit for suspending the system. This pulls in
       sleep.target.
   sleep.target
       A special target unit that is pulled in by suspend.target,
       hibernate.target and hybrid-sleep.target and may be used to hook
       units into the sleep state logic.

它是由系统服务管理器管理的Special System Units的一部分。

运行systemctl start systemd-suspend.service将使您的系统正常休眠,因为它现在是活动的,因此它必须保持不活动状态,直到需要为止。

票数 1
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1434487

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档