Linux systemd service

Linux systemd service

Where are the systemd configuration Files?

systemctl enable ... will print out information about what is being done. For instance, on my Arch system, if I enable the dhcpd service on interface enp0s3

$ systemctl enable dhcpcd@enp0s3
Created symlink from /etc/systemd/system/multi-user.target.wants/dhcpcd@enp0s3.service to /usr/lib/systemd/system/dhcpcd@.service

When disabling this very service, you can see that systemctl removes this previous link…

$ systemctl disable dhcpcd@enp0s3
Removed symlink /etc/systemd/system/multi-user.target.wants/dhcpcd@enp0s3.service

So, from this output, you can tell that…

  • When calling systemctl enable, a symlink is created under /etc/systemd/system/multi-user.target.wants.
  • When calling systemctl disable, this very symlink is removed.

Therefore, if you want to get a list of enabled services (what you’re calling “the configuration”, I suppose), all you have to do is list these links:

ls /etc/systemd/system/multi-user.target.wants

However, you might find more information using systemctl list-unit-files, which will list all available services, and their status (enabled, disabled, static). You’ll see that the enabled ones have a link somewhere under /etc/systemd/system, according to the units they belong to.

$ find /etc/systemd/system -type l

While the directories may change for some distributions, they are the way systemd (and other systems before it) handle their settings. While /etc/systemd holds several configuration files, the unit-specific settings are handled through links. To me, this method is a lot more practical than files, since it allows developers to provide units along with their packages (installed under /usr/lib/systemd/system), but still gives control to the administrator, who gets to decide which units get to be scheduled on the system.

If you’re interested, the Arch Wiki actually provides a nice introduction to systemd. RHEL also has some information about it in their documentation.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

云满笔记

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值