From: Arlin Davis Date: Wed, 16 May 2012 22:51:17 +0000 (-0700) Subject: add daplpdx.init.in X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=a449631bdad4e8dcabcf871e17c9e38925984562;p=~ardavis%2Fdapl.git add daplpdx.init.in --- diff --git a/daplpxd.init.in b/daplpxd.init.in new file mode 100644 index 0000000..7354022 --- /dev/null +++ b/daplpxd.init.in @@ -0,0 +1,99 @@ +#!/bin/bash +# +# Bring up/down the daplpxd daemon +# +# chkconfig: 2345 25 75 +# description: Starts/Stops DAPL SCIF-IB proxy daemon +# +### BEGIN INIT INFO +# Provides: daplpxd +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Short-Description: Starts and stops the DAPL proxy CM service +# Description: The DAPL proxy CM service provides a user space implementation +# that enables SCIF clients to proxy RDMA writes over to large core +# processors +### END INIT INFO + +pidfile=/var/run/daplpxd.pid +subsys=/var/lock/subsys/daplpxd + +. /etc/rc.d/init.d/functions + +start() +{ + echo -n "Starting daplpxd daemon:" + + daemon @prefix@/sbin/daplpxd + RC=$? + [ $RC -eq 0 ] && touch $subsys + echo + return $RC +} + +stop() +{ + echo -n "Stopping daplpxd daemon:" + + killproc -p $pidfile daplpxd + RC=$? + rm -f $subsys + echo + return $RC +} + +status() +{ + if [ ! -f $subsys -a ! -f $pidfile ]; then + return 3 + fi + if [ -f $pidfile ]; then + checkpid `cat $pidfile` + return $? + fi + if [ -f $subsys ]; then + return 2 + fi +} + +restart () +{ + stop + start +} + +condrestart () +{ + [ -e $subsys ] && restart || return 0 +} + +usage () +{ + echo + echo "Usage: `basename $0` {start|stop|restart|condrestart|try-restart|force-reload|status}" + echo + return 2 +} + +case $1 in + start|stop|restart|condrestart|try-restart|force-reload) + [ `id -u` != "0" ] && exit 4 ;; +esac + +case $1 in + start) start; RC=$? ;; + stop) stop; RC=$? ;; + restart) restart; RC=$? ;; + reload) RC=3 ;; + condrestart) condrestart; RC=$? ;; + try-restart) condrestart; RC=$? ;; + force-reload) condrestart; RC=$? ;; + status) status; RC=$? ;; + *) usage; RC=$? ;; +esac + +exit $RC