Thread (3 messages) read the whole thread 3 messages, 3 authors, 2012-10-24

Re: [PATCH 3/4 for opensm] /etc/init.d/opensmd: Improve systemd integration

From: Alex Netes <hidden>
Date: 2012-10-24 13:27:26

Possibly related (same subject, not in this thread)

Hi Bart,

On 16:44 Fri 21 Sep     , Bart Van Assche wrote:
quoted hunk
On recent SLES and openSUSE systems it is necessary to read the
file /lib/lsb/init-functions instead of /etc/rc.status for proper
integration with systemd. Certain implementations of killproc
need a pidfile so make sure that one gets created. Also, correct
the opensm service dependency list.

Signed-off-by: Bart Van Assche <redacted>
Cc: Doug Ledford <redacted>
---
 configure.in                  |    6 ++++++
 scripts/opensm.init.in        |   26 ++++++++++++++++++--------
 scripts/redhat-opensm.init.in |    2 ++
 3 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/configure.in b/configure.in
index f660a5b..4515ae2 100644
--- a/configure.in
+++ b/configure.in
@@ -11,6 +11,12 @@ AM_INIT_AUTOMAKE
 AC_SUBST(RELEASE, ${RELEASE:-unknown})
 AC_SUBST(TARBALL, ${TARBALL:-${PACKAGE}-${VERSION}.tar.gz})
 
+default_rdma_service=openibd
+AC_ARG_WITH([rdma_service],
+    AC_HELP_STRING([--with-rdma-service=name],
+                   [name of the RDMA service: "rdma" when using /etc/init.d/rdma to start RDMA services; "openibd" when using /etc/init.d/openibd to start RDMA services [default=${default_rdma_service}]]))
+AC_SUBST(RDMA_SERVICE, ${with_rdma_service:-${default_rdma_service}})
+
There is also an option to run opensm with ibsim. In that case neither rdma
nor openibd should run.
quoted hunk
 if { rpm -q sles-release || rpm -q openSUSE-release; } >/dev/null 2>&1; then
    default_start="2 3 5"
    default_stop="0 1 4 6"
diff --git a/scripts/opensm.init.in b/scripts/opensm.init.in
index 007dae4..ddd1d6b 100644
--- a/scripts/opensm.init.in
+++ b/scripts/opensm.init.in
@@ -7,8 +7,8 @@
 #
 ### BEGIN INIT INFO
 # Provides: opensm
-# Required-Start: $syslog
-# Required-Stop:
+# Required-Start: $syslog @RDMA_SERVICE@
+# Required-Stop: $syslog @RDMA_SERVICE@
 # Default-Start: @DEFAULT_START@
 # Default-Stop: @DEFAULT_STOP@
 # Description:  Manage OpenSM
@@ -42,14 +42,22 @@
 
 prefix=@prefix@
 exec_prefix=@exec_prefix@
+pidfile=/var/run/opensm.pid
 
 # Source function library.
 if [[ -s /etc/init.d/functions ]]; then
+    # RHEL / CentOS / SL / Fedora.
     . /etc/init.d/functions
     rc_status() { :; }
     rc_exit() { exit $RETVAL; }
-fi
-if [[ -s /etc/rc.status ]]; then
+elif [[ -s /lib/lsb/init-functions ]]; then
+    # SLES / openSuSE / Debian.
+    . /lib/lsb/init-functions
+    rc_exit() { exit $RETVAL; }
+    success() { log_success_msg; }
+    failure() { log_failure_msg; }
+elif [[ -s /etc/rc.status ]]; then
+    # Older SuSE systems.
     . /etc/rc.status
     failure() { rc_status -v; }
     success() { rc_status -v; }
@@ -61,10 +69,13 @@ if [[ -s $CONFIG ]]; then
 fi
 
 start () {
+    if [ -e $pidfile ]; then
On opensm segfault (happens one in a while :), pidfile won't be removed, so
you won't be able to start the opensm again. I guess that same thing can
happen on warm reboot.
+	echo Already started
+	return 1
+    fi
-- Alex
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help