用 systemctl edit 覆盖 unit 参数,别直接改原文件

直接改 /lib/systemd/system 下的 unit 文件,升级会被覆盖。

用 systemctl edit 服务名,生成 override 片段文件。

片段里只写要改的项放进 [Service],其余继承原文件。

改完 daemon-reload 再 restart,用 cat 查最终值。

systemctl edit nginx.service
# 片段落在 /etc/systemd/system/nginx.service.d/override.conf
#   [Service]
#   MemoryMax=512M
systemctl daemon-reload
systemctl restart nginx
systemctl cat nginx.service
THE END
喜欢就支持一下吧
点赞13 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容