From patchwork Fri Jul 13 14:51:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Masayoshi Mizuma X-Patchwork-Id: 10523519 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4F381602A0 for ; Fri, 13 Jul 2018 14:52:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E25429B5C for ; Fri, 13 Jul 2018 14:52:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3166E29B63; Fri, 13 Jul 2018 14:52:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, T_DKIM_INVALID,URIBL_BLACK autolearn=no version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2A12529B5C for ; Fri, 13 Jul 2018 14:52:04 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id AC364209884B7; Fri, 13 Jul 2018 07:52:02 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:400d:c09::243; helo=mail-qk0-x243.google.com; envelope-from=msys.mizuma@gmail.com; receiver=linux-nvdimm@lists.01.org Received: from mail-qk0-x243.google.com (mail-qk0-x243.google.com [IPv6:2607:f8b0:400d:c09::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4CAFE2097FA9E for ; Fri, 13 Jul 2018 07:52:01 -0700 (PDT) Received: by mail-qk0-x243.google.com with SMTP id c192-v6so17291008qkg.12 for ; Fri, 13 Jul 2018 07:52:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=2KNFQaWuPteorItDELyGlCJ1KNXZJfK6229rUE3VGcY=; b=VKZm3klVbflv7q1pX8oFZMoQWsV5WqknCiaMBid8A1qObPOSTgCQRgt6rWeEYqM8M6 LkoiR9JC2btvo0+QBSoGU9T7BgESld4+kPvpyFQW0KrbOce3a7cgRoAgkJFEJs/LtRUM 1CRw5upSzmStTGKU7i/e4aaIitCXMgrjoivu36hPj1vJ2BwuyOApFFhOIhCJvJ8D6ZGD LdAKIay4HqaRRz/xCiewST1sFUEg1LJe9yLy8k4fn1ocJFPF6RuHZ9kaW6dI8ViTVsaZ FHD6S2Vp/sxIzgPrA3f5pE34wKdKGPKa86JCfArYKXRIj0EeGag0eH24yN7fNaaJMUzT 84Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=2KNFQaWuPteorItDELyGlCJ1KNXZJfK6229rUE3VGcY=; b=Erz1bVHyyH0ClnUw976a9CXfYFJAokVOO1ELhD8gtObbHCv1AAla37fb5B/SfTWAty +VPEgrq3uHGHO6cmOhTSxByTOtrVlkMaoMK9L1VDnmR9l7vxevtGzfVoTSFGcV4mucyG DLYLASeG2xd8jtDuR05PofXu2MfVJtYfsqJ/aRSgpu1X8iMbEgD7NUZg62BHE4g82qD+ R6nvslwYkBXEPEBQqprqxiWAPg6pfZ097xkwkgXqytLQr9jLMiEglbCrxlsH+ASTzKBv aNb+E5oa0UVLO4NBLN6SDminhCmFmDQ1kCgVHr0nI5UeL+/FTOVQBBIh0djEjuErcAVD W2+Q== X-Gm-Message-State: AOUpUlGuZ4nmdCSb7aACcEyJ8I58QRpPkc0xxrtZr2WLOsd39LCROJ/h z2mIXF6/YGm0CgECLzf7Kk437qE= X-Google-Smtp-Source: AAOMgpfZJ97dxaeSbXARnx8+vHp5Ch/OooVTQXlJ94zq788KzgKzmyWtaA5l6ocNQAy5iuTleVjYgA== X-Received: by 2002:a37:1f87:: with SMTP id n7-v6mr5550592qkh.308.1531493519788; Fri, 13 Jul 2018 07:51:59 -0700 (PDT) Received: from [10.18.17.172] (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id l84-v6sm20792674qki.69.2018.07.13.07.51.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Jul 2018 07:51:59 -0700 (PDT) Subject: Re: [ndctl PATCH v11 3/5] ndctl, monitor: add the unit file of systemd for ndctl-monitor service To: qi.fuli@jp.fujitsu.com, vishal.l.verma@intel.com, linux-nvdimm@lists.01.org References: <20180711030012.9186-1-qi.fuli@jp.fujitsu.com> <20180711030012.9186-4-qi.fuli@jp.fujitsu.com> <1531450017.7574.107.camel@intel.com> <0DEDF3B159719A448A49EF0E7B11E3223DA7FE29@g01jpexmbkw24> From: Masayoshi Mizuma Message-ID: <4f7fdea3-3d05-030b-7cb1-e7781459ba81@gmail.com> Date: Fri, 13 Jul 2018 10:51:58 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <0DEDF3B159719A448A49EF0E7B11E3223DA7FE29@g01jpexmbkw24> Content-Language: en-US X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP Hi Qi, On 07/13/2018 08:57 AM, Qi, Fuli wrote: >> -----Original Message----- >> From: Verma, Vishal L [mailto:vishal.l.verma@intel.com] >> Sent: Friday, July 13, 2018 11:47 AM >> To: linux-nvdimm@lists.01.org; Qi, Fuli/斉 福利 >> Subject: Re: [ndctl PATCH v11 3/5] ndctl, monitor: add the unit file of systemd for >> ndctl-monitor service >> >> >> On Wed, 2018-07-11 at 12:00 +0900, QI Fuli wrote: >>> This patch adds the systemd unit file for ndctl-monitor service. >>> The systemd unit directory can be configured by setting environment >>> variable "--with-systemd-unit-dir[=DIR]". >>> >>> A monitor daemon can be started as a system service: >>> # systemctl start ndctl-monitor.service >>> >>> Signed-off-by: QI Fuli >>> --- >>> autogen.sh | 3 ++- >>> configure.ac | 22 ++++++++++++++++++++++ >>> ndctl/Makefile.am | 4 ++++ >>> ndctl/ndctl-monitor.service | 7 +++++++ >>> 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 >>> ndctl/ndctl-monitor.service >> >> We install the service unit file when doing a 'make install', but I think this also >> needs an update to the RPM spec file so that RPM knows about this too. >> > > Yes, I think both the configuration file and the service unit file are need to update the > RPM spec file. I knew that hard code the path of the files is not right, and I tried to > add %{_monitor_configdir}/monitor.conf and %{_systemd_unitdir}/ndctl-monitor.service in ndctl.spec.in, > but I got failed. Would you please tell me how to update the RPM spec file? How about the following? Thanks, Masa > > Thank you very much. > QI > >>> >>> diff --git a/autogen.sh b/autogen.sh >>> index 2a52688..21b0e25 100755 >>> --- a/autogen.sh >>> +++ b/autogen.sh >>> @@ -17,7 +17,8 @@ libdir() { >>> >>> args="--prefix=/usr \ >>> --sysconfdir=/etc \ >>> ---libdir=$(libdir /usr/lib)" >>> +--libdir=$(libdir /usr/lib) \ >>> +--with-systemd-unit-dir" >>> >>> echo >>> echo "------------------------------------------------------------ >>> ----" >>> diff --git a/configure.ac b/configure.ac index cf44260..a5ba9a1 100644 >>> --- a/configure.ac >>> +++ b/configure.ac >>> @@ -143,6 +143,27 @@ AC_CHECK_FUNCS([ \ >>> secure_getenv\ >>> ]) >>> >>> +PKG_PROG_PKG_CONFIG >>> +AC_ARG_WITH([systemd-unit-dir], >>> + AS_HELP_STRING([--with-systemd-unit-dir[=DIR]], >>> + [Directory for systemd service files]), >>> + [], >>> + [with_systemd_unit_dir=yes]) >>> + >>> +if test "x$with_systemd_unit_dir" = "xyes"; then >>> + def_systemd_unit_dir=$($PKG_CONFIG -- >>> variable=systemdsystemunitdir systemd) >>> + if test "x$def_systemd_unit_dir" = "x"; then >>> + AC_MSG_ERROR([systemd support requested but pkg- >>> config unable to query systemd package]) >>> + with_systemd_unit_dir=no >>> + else >>> + with_systemd_unit_dir="$def_systemd_unit_dir" >>> + fi >>> +fi >>> + >>> +AS_IF([test "x$with_systemd_unit_dir" != "xno"], >>> + [AC_SUBST([systemd_unitdir], [$with_systemd_unit_dir])]) >>> +AM_CONDITIONAL([ENABLE_SYSTEMD_UNIT_DIR], [test >>> "x$with_systemd_unit_dir" != "xno"]) >>> + >>> my_CFLAGS="\ >>> -Wall \ >>> -Wchar-subscripts \ >>> @@ -184,6 +205,7 @@ AC_MSG_RESULT([ >>> sysconfdir: ${sysconfdir} >>> libdir: ${libdir} >>> includedir: ${includedir} >>> + systemd-unit-dir: ${systemd_unitdir} >>> >>> compiler: ${CC} >>> cflags: ${CFLAGS} >>> diff --git a/ndctl/Makefile.am b/ndctl/Makefile.am index >>> ae3d894..9d008d5 100644 >>> --- a/ndctl/Makefile.am >>> +++ b/ndctl/Makefile.am >>> @@ -47,3 +47,7 @@ monitor_config_file = monitor.conf >>> monitor_configdir = /etc/ndctl/ monitor_config_DATA = >>> $(monitor_config_file) EXTRA_DIST += $(monitor_config_file) >>> + >>> +if ENABLE_SYSTEMD_UNIT_DIR >>> +systemd_unit_DATA = ndctl-monitor.service endif >>> diff --git a/ndctl/ndctl-monitor.service b/ndctl/ndctl- >>> monitor.service new file mode 100644 index 0000000..44f9326 >>> --- /dev/null >>> +++ b/ndctl/ndctl-monitor.service >>> @@ -0,0 +1,7 @@ >>> +[Unit] >>> +Description=Ndctl Monitor Daemon >>> + >>> +[Service] >>> +Type=forking >>> +ExecStart=/usr/bin/ndctl monitor --daemon ExecStop=/bin/kill >>> +${MAINPID} > _______________________________________________ > Linux-nvdimm mailing list > Linux-nvdimm@lists.01.org > https://lists.01.org/mailman/listinfo/linux-nvdimm > diff --git a/ndctl.spec.in b/ndctl.spec.in index e2c879c..07b85a3 100644 --- a/ndctl.spec.in +++ b/ndctl.spec.in @@ -116,6 +116,8 @@ make check %{_bindir}/ndctl %{_mandir}/man1/ndctl* %{bashcompdir}/ +%{_sysconfdir}/ndctl/monitor.conf +%{_unitdir}/ndctl-monitor.service %files -n daxctl %defattr(-,root,root)