LoginSignup
0

posted at

Organization

systemdのユニットファイルを読み込むパスを知りたい

systemdのユニットファイルを配置しようと、配置場所を考えていた際に、どのパスのファイルを読み込んでいるのか気になったので調べた。

なお、環境はUbuntu22.04。

結論

以下のようにするとわかる。

$ systemctl --no-pager --property UnitPath show
UnitPath=/etc/systemd/system.control /run/systemd/system.control /run/systemd/transient /run/systemd/generator.early /etc/systemd/system /etc/systemd/system.attached /run/systemd/system /run/systemd/system.attached /run/systemd/generator /usr/local/lib/systemd/system /lib/systemd/system /usr/lib/systemd/system /run/systemd/generator.late

以下はこの記事において蛇足だが、
実際に配置する場所としては、

Ubuntu Manpage: systemd-system.conf, system.conf.d, systemd-user.conf, user.conf.d - System and session に、

When packages need to customize the configuration, they can install configuration snippets in /usr/lib/systemd/*.conf.d/. Files in /etc/ are reserved for the local administrator, who may use this logic to override the configuration files installed by vendor packages.

とあるのを考慮すると、
/usr/lib/systemd/system配下に配置するのが良さそうな感じがする。

Ref

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
0