[Pkg-ofed-commits] r983 - in /trunk/srptools/trunk/debian: control srptools.init
gmpc-guest at alioth.debian.org
gmpc-guest at alioth.debian.org
Thu Jan 19 13:11:13 UTC 2012
Author: gmpc-guest
Date: Thu Jan 19 13:11:12 2012
New Revision: 983
URL: http://svn.debian.org/wsvn/pkg-ofed/?sc=1&rev=983
Log:
Make srp_deamon actually a deamon.
Modified:
trunk/srptools/trunk/debian/control
trunk/srptools/trunk/debian/srptools.init
Modified: trunk/srptools/trunk/debian/control
URL: http://svn.debian.org/wsvn/pkg-ofed/trunk/srptools/trunk/debian/control?rev=983&op=diff
==============================================================================
--- trunk/srptools/trunk/debian/control (original)
+++ trunk/srptools/trunk/debian/control Thu Jan 19 13:11:12 2012
@@ -10,7 +10,7 @@
Package: srptools
Architecture: i386 ia64 amd64 powerpc
-Depends: ${shlibs:Depends}, ${misc:Depends}, infiniband-diags
+Depends: ${shlibs:Depends}, ${misc:Depends}, infiniband-diags, daemon
Description: Tools for Infiniband attached storage (SRP)
In conjunction with the kernel ib_srp driver, srptools allows you to
discover and use Infiniband attached storage devices which use the
Modified: trunk/srptools/trunk/debian/srptools.init
URL: http://svn.debian.org/wsvn/pkg-ofed/trunk/srptools/trunk/debian/srptools.init?rev=983&op=diff
==============================================================================
--- trunk/srptools/trunk/debian/srptools.init (original)
+++ trunk/srptools/trunk/debian/srptools.init Thu Jan 19 13:11:12 2012
@@ -1,8 +1,8 @@
#!/bin/bash
### BEGIN INIT INFO
# Provides: srptools
-# Required-Start: $remote_fs $syslog
-# Required-Stop: $remote_fs $syslog
+# Required-Start: $syslog
+# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Discovers SRP scsi targets.
@@ -45,6 +45,33 @@
done
}
+stop_daemon () {
+
+if [ "$PORTS" = "NONE" ] ; then
+echo "srptools disabled."
+exit 0
+fi
+
+
+if [ "$PORTS" = "ALL" ] ; then
+ for HCA_ID in `/bin/ls -1 ${IBDIR}`
+ do
+ for PORT in `/bin/ls -1 ${IBDIR}/${HCA_ID}/ports/`
+ do
+ kill_daemon
+ done
+ done
+return 0
+fi
+
+
+for ADAPTER in $PORTS ; do
+ HCA_ID=`echo $ADAPTER | awk -F: '{print $1}'`
+ PORT=`echo $ADAPTER | awk -F: '{print $2}'`
+ kill_daemon
+done
+}
+
run_daemon() {
# SRP deamon wedges if we start it on a port which is not up
@@ -54,23 +81,14 @@
if [ "$STATUS" = "State: Active" ] ; then
echo "Starting srp on $HCA_ID $PORT"
-# srp does not background itself; using the start-stop-daemon background function
-# causes us to lose stdout, which is where it logs to.
- nohup start-stop-daemon --start --quiet -m --pidfile /var/run/srp_daemon.${HCA_ID}.${PORT} \
- --exec /usr/sbin/srp_daemon -- -e -c -n -i ${HCA_ID} -p ${PORT} -R ${RETRIES} >> $LOG 2>&1 &
+ daemon -r --pidfile /var/run/srp_daemon.${HCA_ID}.${PORT} -- /usr/sbin/srp_daemon -e -c -n -i ${HCA_ID} -p ${PORT} -R ${RETRIES} >> $LOG
RETVAL=$?
fi
}
-stop_daemon () {
- for HCA_ID in `/bin/ls -1 ${IBDIR}`
- do
- for PORT in `/bin/ls -1 ${IBDIR}/${HCA_ID}/ports/`
- do
- start-stop-daemon --stop --quiet --oknodo -m --pidfile /var/run/srp_daemon.${HCA_ID}.${PORT}
- RETVAL=$?
- done
- done
+kill_daemon () {
+ PID=`cat /var/run/srp_daemon.${HCA_ID}.${PORT}`
+ kill -TERM $PID
}
More information about the Pkg-ofed-commits
mailing list