运行服务的进程在哪里?

运行服务的进程在哪里?

服务正在运行:

» sudo service cntlm status

● cntlm.service - LSB: Authenticating HTTP accelerator for NTLM secured proxies
   Loaded: loaded (/etc/init.d/cntlm; bad; vendor preset: enabled)
   Active: active (exited) since Tue 2018-02-20 12:01:02 CET; 3min 33s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 9215 ExecStop=/etc/init.d/cntlm stop (code=exited, status=0/SUCCESS)
  Process: 9298 ExecStart=/etc/init.d/cntlm start (code=exited, status=0/SUCCESS)
    Tasks: 0
   Memory: 0B
      CPU: 0

Feb 20 12:01:02 host1 systemd[1]: Starting LSB: Authenticating HTTP accelerator for NTLM secured proxies...
Feb 20 12:01:02 host1 cntlm[9298]: Starting CNTLM Authentication Proxy: failed!
Feb 20 12:01:02 host1 systemd[1]: Started LSB: Authenticating HTTP accelerator for NTLM secured proxies.

但没有过程:

» ps -ef | grep cntlm
dangonfast 12466 13067  0 12:05 pts/19   00:00:00 grep --color=auto cntlm

这是为什么?

答案1

生成的 .servicessystemd-sysv-generator具有指令RemainAfterExit=yes集。根据systemd.service联机帮助页,RemainAfterExit:

采用一个布尔值,指定即使服务的所有进程都退出,服务是否也应被视为活动的。默认为否。

答案2

该服务已执行并退出。对于以“一次性”模式运行的服务来说,这是一种正常情况。它们的定义在 /etc/systemd/system/ 中.service 或 /usr/lib/systemd/system/.service 例如可以包括:

[Service]
Type=oneshot
RemainAfterExit=yes

相关内容