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。
分类:
标签:
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
2023-12-31 歌单布尔匹配