From patchwork Thu Apr 26 11:30:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: QI Fuli X-Patchwork-Id: 10365669 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 2C7B1601D3 for ; Thu, 26 Apr 2018 11:33:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B79B28CCA for ; Thu, 26 Apr 2018 11:33:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 107A32908A; Thu, 26 Apr 2018 11:33:36 +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.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,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 9E13028CCA for ; Thu, 26 Apr 2018 11:33:35 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 95ACA2035D6DE; Thu, 26 Apr 2018 04:33:35 -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=211.128.242.43; helo=mgwym04.jp.fujitsu.com; envelope-from=qi.fuli@jp.fujitsu.com; receiver=linux-nvdimm@lists.01.org Received: from mgwym04.jp.fujitsu.com (mgwym04.jp.fujitsu.com [211.128.242.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D88C62035D6CC for ; Thu, 26 Apr 2018 04:33:33 -0700 (PDT) Received: from yt-mxoi2.gw.nic.fujitsu.com (unknown [192.168.229.69]) by mgwym04.jp.fujitsu.com with smtp id 7f66_0423_b130070a_6ee1_4ce4_8825_c16a8a2819f1; Thu, 26 Apr 2018 20:33:27 +0900 Received: from m3050.s.css.fujitsu.com (msm.b.css.fujitsu.com [10.134.21.208]) by yt-mxoi2.gw.nic.fujitsu.com (Postfix) with ESMTP id F2AA8AC03BC for ; Thu, 26 Apr 2018 20:33:26 +0900 (JST) Received: from qi-fedora.fujitsu.com (unknown [10.124.196.110]) by m3050.s.css.fujitsu.com (Postfix) with ESMTP id DD07F565; Thu, 26 Apr 2018 20:33:26 +0900 (JST) From: QI Fuli To: linux-nvdimm@lists.01.org Subject: [PATCH v5 4/4] ndctl, monitor: add the unit file of systemd for ndctl-monitor service Date: Thu, 26 Apr 2018 20:30:50 +0900 Message-Id: <20180426113050.11424-5-qi.fuli@jp.fujitsu.com> X-Mailer: git-send-email 2.17.0.140.g0b0cc9f86 In-Reply-To: <20180426113050.11424-1-qi.fuli@jp.fujitsu.com> References: <20180426113050.11424-1-qi.fuli@jp.fujitsu.com> X-TM-AS-MML: disable X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP 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]". 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 diff --git a/autogen.sh b/autogen.sh index a23cf53..b226c7a 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 cddad16..60c6537 100644 --- a/configure.ac +++ b/configure.ac @@ -135,6 +135,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_UNIT_DIR], [$with_systemd_unit_dir])]) +AM_CONDITIONAL([ENABLE_SYSTEMD_UNIT_DIR], [test "x$with_systemd_unit_dir" != "xno"]) + my_CFLAGS="\ -Wall \ -Wchar-subscripts \ @@ -172,6 +193,7 @@ AC_MSG_RESULT([ sysconfdir: ${sysconfdir} libdir: ${libdir} includedir: ${includedir} + systemd-unit-dir: ${SYSTEMD_UNIT_DIR} compiler: ${CC} cflags: ${CFLAGS} diff --git a/ndctl/Makefile.am b/ndctl/Makefile.am index ae3d894..b3053d0 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_unitDATA = 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}