After the fix in commit-id cf50e10170b301542c968da6cdc278fd41730820 PID file no longer exists in /var/run. As a result on initd.fedora fails to check if fcoemon was already started. This patch fixes the issue by using -p option to obtain the PID, and not relying on the PID_FILE to check if fcoemon is already running
Signed-off-by: Bhanu Prakash Gollapudi <[email protected]> --- etc/initd/initd.fedora | 28 +++++++++++++++------------- 1 files changed, 15 insertions(+), 13 deletions(-) diff --git a/etc/initd/initd.fedora b/etc/initd/initd.fedora index 128d587..f20ed24 100755 --- a/etc/initd/initd.fedora +++ b/etc/initd/initd.fedora @@ -30,7 +30,6 @@ ### END INIT INFO CONFIG_DIR=/etc/fcoe -PID_FILE="/var/run/fcoemon.pid" LOG_FILE="/var/log/fcoemon.log" LOCKFILE="/var/lock/subsys/fcoe" FCOEMON=/usr/sbin/fcoemon @@ -68,23 +67,26 @@ start() { echo -n $"Starting FCoE initiator service: " - modprobe -q libfc - modprobe -q sg - modprobe -q -a $SUPPORTED_DRIVERS + pid=$($FCOEADM -p 2> /dev/null) + if [ -z "$pid" ]; then + modprobe -q libfc + modprobe -q sg + modprobe -q -a $SUPPORTED_DRIVERS - daemon --pidfile ${PID_FILE} ${FCOEMON} ${FCOEMON_OPTS} - - echo - touch ${LOCKFILE} - - echo + daemon ${FCOEMON} ${FCOEMON_OPTS} + echo + touch ${LOCKFILE} + echo + else + echo "(already running)" + fi } stop() { local force=$1 - pid=$(pidof "$FCOEMON") + pid=$($FCOEADM -p 2> /dev/null) if [ "$force" == "force" ] then action "Destroying any active fcoe interface/s" @@ -96,7 +98,6 @@ stop() action $"Stopping FCoE initiator service: " - rm -f ${PID_FILE} rm -f ${LOCKFILE} } @@ -105,7 +106,8 @@ status() [ -f ${LOCKFILE} ] || { echo "$FCOEMON is stopped" ; return 3; } status=0 - echo "$FCOEMON is running, pid=`cat $PID_FILE`" + pid=$($FCOEADM -p 2> /dev/null) + echo "$FCOEMON is running, pid=$pid" interfaces=`$FCOEADM -i 2>&1 | \ awk '/Symbolic Name:/{print $6}' | \ -- 1.7.1 _______________________________________________ fcoe-devel mailing list [email protected] http://lists.open-fcoe.org/mailman/listinfo/fcoe-devel
