]> git.openfabrics.org - ~ardavis/dapl.git/commitdiff
mpxyd: mpxyd does not start on SLES11SP2
authorArlin Davis <arlin.r.davis@intel.com>
Fri, 15 Mar 2013 21:55:19 +0000 (14:55 -0700)
committerArlin Davis <arlin.r.davis@intel.com>
Fri, 15 Mar 2013 21:55:19 +0000 (14:55 -0700)
add checking for SUSE and RH and process
accordingly.

Signed-off-by: Patrick Mccormick <patrick.m.mccormick@intel.com>
Signed-off-by: Arlin Davis <arlin.r.davis@intel.com>
mpxyd.init.in

index 7afc2f5008e26648d10c6b3d90c72e75f37ea8df..78414d9cb16561e6d71df2434ec4c2caf1faf4f9 100644 (file)
@@ -15,7 +15,7 @@
 # Should-Stop:
 # Short-Description: Starts and stops the MIC SCIF/DAPL RDMA proxy server
 # Description: The DAPL proxy RDMA server provides a user space implementation
-#      that enables MIC clients to proxy InfiniBand RDMA over to large core resources
+#    that enables MIC clients to proxy InfiniBand RDMA over to large core resources
 ### END INIT INFO
 
 prog=mpxyd
@@ -23,35 +23,52 @@ execpath=@prefix@/sbin/${prog}
 pidfile=`grep ^lock_file @sysconfdir@/mpxyd.conf | awk '{print $2}'`
 subsys=/var/lock/subsys/${prog}
 
-. /etc/rc.d/init.d/functions
+# Source function library.
+if [ -f /etc/init.d/functions ]; then
+    # RHEL
+    . /etc/init.d/functions
+    _status='status -p "$pidfile" -l $subsys'
+    _start='daemon --check $prog --pidfile "$pidfile"'
+    _ret='echo; return $RC'
+elif [ -f /etc/rc.status ]; then
+    # SLES
+    . /etc/rc.status
+    _status=checkproc
+    _start='start_daemon -p "$pidfile"'
+    _ret='rc_status -v'
+else
+    # other
+    echo "Could not source init function library, exiting"
+    return 1
+fi
 
 start()
 {
-    echo -n "Starting mpxyd daemon:"
+    echo -n "Starting mpxyd daemon: "
 
-    daemon --check $prog --pidfile "$pidfile" $execpath
+    eval $_start $execpath
     RC=$?
 
     [ "$RC" -eq "0" ] && touch $subsys 2>/dev/null
 
-    echo
-    return $RC
+    eval $_ret
 }
 
 stop()
 {
-    echo -n "Stopping mpxyd daemon:"
+    echo -n "Stopping mpxyd daemon: "
 
-    killproc -p "$pidfile" $execpath
+    killproc -p $pidfile $execpath
     RC=$?
     rm -f $subsys
-    echo
-    return $RC
+
+    eval $_ret
 }
 
-_status()
+sstatus()
 {
-    status -p "$pidfile" -l $subsys $prog
+    eval $_status $execpath RC=$?
+    eval $_ret
 }
 
 restart ()
@@ -81,7 +98,7 @@ case $1 in
     condrestart) condrestart; RC=$? ;;
     try-restart) condrestart; RC=$? ;;
     force-reload) condrestart; RC=$? ;;
-    status) _status; RC=$? ;;
+    status) sstatus; RC=$? ;;
     *) usage; RC=$? ;;
 esac