diff mbox series

ndctl, monitor: use type=simple instead of type=forking

Message ID 20190108083423.6996-1-jthumshirn@suse.de (mailing list archive)
State Accepted
Commit 6efb0a555a21f9cb8b7219e30a819731bc28d27b
Headers show
Series ndctl, monitor: use type=simple instead of type=forking | expand

Commit Message

Johannes Thumshirn Jan. 8, 2019, 8:34 a.m. UTC
There is no need to use Type=forking for 'ndctl monitor', Type=simple is
sufficient.

When we use Type=forking and try to run ndctl monitor on a machine without
pmem we even get the following error in the journal:

Jan 07 13:34:54 bragi systemd[1]: Starting Ndctl Monitor Daemon...
Jan 07 13:34:54 bragi ndctl[13776]: custom logging function 0x55ea57d60250 registered
Jan 07 13:34:54 bragi systemd[1]: Started Ndctl Monitor Daemon.
Jan 07 13:34:54 bragi ndctl[13777]: ndctl monitor daemon started
Jan 07 13:34:54 bragi kill[13778]: kill: cannot find process ""
Jan 07 13:34:54 bragi systemd[1]: ndctl-monitor.service: Control process exited, code=exited status=1
Jan 07 13:34:54 bragi systemd[1]: ndctl-monitor.service: Unit entered failed state.
Jan 07 13:34:54 bragi systemd[1]: ndctl-monitor.service: Failed with result 'exit-code'.

This is because the daemon exits and systemd is not able to determine
$MAINPID anymore.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
 ndctl/ndctl-monitor.service | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Dan Williams Jan. 8, 2019, 5:08 p.m. UTC | #1
On Tue, Jan 8, 2019 at 12:34 AM Johannes Thumshirn <jthumshirn@suse.de> wrote:
>
> There is no need to use Type=forking for 'ndctl monitor', Type=simple is
> sufficient.
>
> When we use Type=forking and try to run ndctl monitor on a machine without
> pmem we even get the following error in the journal:
>
> Jan 07 13:34:54 bragi systemd[1]: Starting Ndctl Monitor Daemon...
> Jan 07 13:34:54 bragi ndctl[13776]: custom logging function 0x55ea57d60250 registered
> Jan 07 13:34:54 bragi systemd[1]: Started Ndctl Monitor Daemon.
> Jan 07 13:34:54 bragi ndctl[13777]: ndctl monitor daemon started
> Jan 07 13:34:54 bragi kill[13778]: kill: cannot find process ""
> Jan 07 13:34:54 bragi systemd[1]: ndctl-monitor.service: Control process exited, code=exited status=1
> Jan 07 13:34:54 bragi systemd[1]: ndctl-monitor.service: Unit entered failed state.
> Jan 07 13:34:54 bragi systemd[1]: ndctl-monitor.service: Failed with result 'exit-code'.
>
> This is because the daemon exits and systemd is not able to determine
> $MAINPID anymore.
>
> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>

Looks good to me.

Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Verma, Vishal L Jan. 8, 2019, 6:56 p.m. UTC | #2
On Tue, 2019-01-08 at 09:34 +0100, Johannes Thumshirn wrote:
> There is no need to use Type=forking for 'ndctl monitor', Type=simple is
> sufficient.
> 
> When we use Type=forking and try to run ndctl monitor on a machine without
> pmem we even get the following error in the journal:
> 
> Jan 07 13:34:54 bragi systemd[1]: Starting Ndctl Monitor Daemon...
> Jan 07 13:34:54 bragi ndctl[13776]: custom logging function 0x55ea57d60250 registered
> Jan 07 13:34:54 bragi systemd[1]: Started Ndctl Monitor Daemon.
> Jan 07 13:34:54 bragi ndctl[13777]: ndctl monitor daemon started
> Jan 07 13:34:54 bragi kill[13778]: kill: cannot find process ""
> Jan 07 13:34:54 bragi systemd[1]: ndctl-monitor.service: Control process exited, code=exited status=1
> Jan 07 13:34:54 bragi systemd[1]: ndctl-monitor.service: Unit entered failed state.
> Jan 07 13:34:54 bragi systemd[1]: ndctl-monitor.service: Failed with result 'exit-code'.
> 
> This is because the daemon exits and systemd is not able to determine
> $MAINPID anymore.
> 
> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
> ---
>  ndctl/ndctl-monitor.service | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)

Thanks, applied.
diff mbox series

Patch

diff --git a/ndctl/ndctl-monitor.service b/ndctl/ndctl-monitor.service
index 342a1b1972d5..eeedbd30bb42 100644
--- a/ndctl/ndctl-monitor.service
+++ b/ndctl/ndctl-monitor.service
@@ -2,9 +2,8 @@ 
 Description=Ndctl Monitor Daemon
 
 [Service]
-Type=forking
-ExecStart=/usr/bin/ndctl monitor --daemon
-ExecStop=/bin/kill ${MAINPID}
+Type=simple
+ExecStart=/usr/bin/ndctl monitor
 
 [Install]
 WantedBy=multi-user.target