Debian

systemd:如何創建一個新的 .slice 文件?

  • July 8, 2020

我正在努力了解如何在我的 debian 10 系統上設置新切片。我system-db.slice通過複製system.slice和更改幾件事創建了一個文件:

#  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=System DB Slice
Documentation=man:systemd.special(7)
DefaultDependencies=no
Before=slices.target
Requires=system.slice
After=system.slice

這似乎根本沒有做任何事情。例如,它不會出現在 中systemd-cgls。另一方面,systemctl發現它:

# systemctl status system-db.slice
● system-db.slice - System DB Slice
  Loaded: loaded (/etc/systemd/system/system-db.slice; static; vendor preset: enabled)
  Active: inactive (dead)
    Docs: man:systemd.special(7)

顯然有些事情我沒有做或做錯。我應該怎麼做?我在哪裡可以了解更多資訊?

僅當啟動使用該切片的服務時才會啟動該切片。您無需手動啟動它。相反,您添加Slice=my.slice到要受此切片限制的單元。

引用自:https://serverfault.com/questions/1024514