Emotio|

Nolca

园龄:6年9个月粉丝:12关注:9

📂开发
🔖linux
2024-12-31 09:30阅读: 27评论: 0推荐: 0

systemd edit后如何消除Warning

症状

> sudo systemctl start mihayo.service
Warning: The unit file, source configuration file or drop-ins of mihayo.service changed on disk. Run 'systemctl daemon-reload' to reload units.

然而,如果你老老实实去sudo systemctl daemon-reload后,你会发现,你的配置文件被覆写了。

1.强制覆盖

> locate mihayo.service
/etc/systemd/system/mihayo.service
/etc/systemd/system/multi-user.target.wants/mihayo.service

修改.service后:

sudo systemctl revert mihayo.service &&\
sudo systemctl daemon-reload &&\
sudo systemctl restart mihayo.service

2. override.conf

systemd限制: https://bbs.archlinux.org/viewtopic.php?pid=1379005#p1379005
要先空白赋值一次,才能覆盖Exec...参数:

### Editing /etc/systemd/system/mihomo.service.d/override.conf
### Anything between here and the comment below will become the contents of the drop-in file
[Service]
ExecStart=
ExecStart=/usr/bin/in.tftpd -s /home/frank/tftp/
### Edits below this comment will be discarded
### /etc/systemd/system/mihomo.service
# [Unit]
# #...
# [Service]
# ExecStart=/usr/bin/in.tftpd

修改默认systemd edit编辑器

vim ~/.bashrc # 添加`export EDITOR=vim`一行
sudo visudo # 取消注释`Defaults...EDITOR`一行

然后重启terminal。

本文作者:Nolca

本文链接:https://www.cnblogs.com/nolca/p/18643128

版权声明:本作品采用 收益分享revenue sharing 许可协议进行许可。

posted @   Nolca  阅读(27)  评论(0编辑  收藏  举报
历史上的今天:
2023-12-31 歌单布尔匹配
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起
  1. 1 ⏩intro 山姆精
  2. 2 🎸吉他 马叉
  3. 3 ☁升调 山姆精
  4. 4 🐦Flutter Virtual Riot/Madi
  5. 5 🎶纯律 山姆精
  6. 6 👻yeah~Color Bass! VR
🎸吉他 - 马叉
00:00 / 00:00
An audio error has occurred, player will skip forward in 2 seconds.