AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 986840
Accepted
425nesp
425nesp
Asked: 2019-10-05 14:08:53 +0800 CST2019-10-05 14:08:53 +0800 CST 2019-10-05 14:08:53 +0800 CST

systemd 如何要求单元重新加载配置?

  • 772

我正在阅读手册页systemctl reload,发现这句话是关于reload.

reload PATTERN...
    Asks all units listed on the command line to reload their
    configuration.

http://man7.org/linux/man-pages/man1/systemctl.1.html

systemd 是如何做到这一点的?systemd 使用什么 API 来要求单元重新加载其配置?

我也发现了reload-or-restart。

 reload-or-restart PATTERN...
     Reload one or more units if they support it. If not, restart them
     instead.

systemd 如何知道该单元是否支持重新加载?

systemd
  • 1 1 个回答
  • 4780 Views

1 个回答

  • Voted
  1. Best Answer
    Throw Away Account
    2019-10-05T17:21:05+08:002019-10-05T17:21:05+08:00

    以下是手册页systemd.service关于重新加载的内容:

           ExecReload=
               Commands to execute to trigger a configuration reload in the 
               service. This argument takes multiple command lines, following
               the same scheme as described for ExecStart= above. Use of
               this setting is optional. Specifier and environment variable
               substitution is supported here following the same scheme as
               for ExecStart=.
    
               One additional, special environment variable is set: if known,
               $MAINPID is set to the main process of the daemon, and may
               be used for command lines like the following:
    
                   /bin/kill -HUP $MAINPID
    
               Note however that reloading a daemon by sending a signal
               (as with the example line above) is usually not a good
               choice, because this is an asynchronous operation and hence
               not suitable to order reloads of multiple services against
               each other. It is strongly recommended to set ExecReload=
               to a command that not only triggers a configuration reload
               of the daemon, but also synchronously waits for it to complete.
    
    

    (要知道systemd.service要查看的正确手册页的唯一方法是谷歌搜索ExecReload,这是我在挖掘 Systemd 的源代码后猜到的一个字符串。)

    • 12

相关问题

  • SSH 会话在关机/重启时挂起

  • 我可以使用 systemd 重新启动依赖服务吗?

  • 让我的旧初始化脚本在 systemd 中工作的最简单方法是什么?

  • 在 CentOS 7 上为 systemd 启动的进程增加 nproc

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve