commit 4322929c30a2f2bb57ebb1d427eb7536adb05dc1 Author: Hannes Reinecke Date: Thu Nov 6 09:16:00 2008 +0100 Handle arguments to multipathd from the init file Introduces a $ARGS variable through which we could pass arguments to multipathd. There's also a change in the stop section of the initscript. If multipathd is manually executed with an option like "-v9", the output of $DAEMON does not match $PROCNAME. This leads to multipathd never being killed when stop is called Signed-off-by: Ritesh Raj Sarraf Signed-off-by: Hannes Reinecke diff --git a/multipathd/multipathd.init.suse b/multipathd/multipathd.init.suse index 664a4c5..d9bcc51 100755 --- a/multipathd/multipathd.init.suse +++ b/multipathd/multipathd.init.suse @@ -22,6 +22,7 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin DAEMON=/sbin/multipathd PIDFILE=/var/run/multipathd.pid +ARGS="" # Set the maximum number of open files MAX_OPEN_FDS=4096 @@ -46,11 +47,11 @@ case "$1" in if [ -f $PIDFILE ]; then PID="$(cat $PIDFILE)" - PROCNAME="$(ps -o cmd --no-headers $PID)" + PROCNAME="$(ps -p $PID -o comm=)" fi - if [ "$PROCNAME" != "$DAEMON" ]; then - $DAEMON + if [ "$PROCNAME" != `basename $DAEMON` ]; then + $DAEMON $ARGS fi # Remember status and be verbose @@ -64,10 +65,10 @@ case "$1" in # So implement a cruder version: if [ -f $PIDFILE ]; then PID="$(cat $PIDFILE)" - PROCNAME="$(ps -o cmd --no-headers $PID)" + PROCNAME="$(ps -p $PID -o comm=)" fi - if [ "$PROCNAME" == "$DAEMON" ]; then + if [ "$PROCNAME" == `basename $DAEMON` ]; then kill -TERM $PID fi @@ -109,8 +110,8 @@ case "$1" in if [ -f $PIDFILE ]; then PID="$(cat $PIDFILE)" - PROCNAME="$(ps -o cmd --no-headers $PID)" - if [ "$PROCNAME" == "$DAEMON" ]; then + PROCNAME="$(ps -p $PID -o comm=)" + if [ "$PROCNAME" == `basename $DAEMON` ]; then (exit 0) else (exit 1)