[ofa-general] Re: [PATCH] opensm/scripts: handling opensm config file

Yevgeny Kliteynik kliteyn at dev.mellanox.co.il
Wed Oct 22 12:17:05 PDT 2008


Sasha Khapyorsky wrote:
> On 10:23 Wed 22 Oct     , Al Chu wrote:
>> Absolutely.  My point being that if you wanted to specify an alternate
>> config path (w/o editting the init script), I think specify OPTIONS in
>> the sysconfig is the only way??
> 
> Ok. I see your point.
> 
> So let's just unify things. I would suggest at least to call the file in
> '/etc/sysconfig/opensm' and not 'opensm.conf' to prevent confusions with
> OpenSM config. The patch is below, any objections, comments?

I'm all for it.

-- Yevgeny

> Sasha
> 
> 
>>From d2771cd83bc69e3fed00be0eecea943d53d5b0eb Mon Sep 17 00:00:00 2001
> From: Sasha Khapyorsky <sashak at voltaire.com>
> Date: Wed, 22 Oct 2008 20:56:37 +0200
> Subject: [PATCH] opensm/scripts: unify scripts' config
> 
> Startup scripts will use /etc/sysconfig/opensm file as its config
> scripts where various environment variables could be defined.
> 
> Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
> ---
>  opensm/scripts/opensm.init.in        |    8 +++++---
>  opensm/scripts/redhat-opensm.init.in |    6 +++---
>  opensm/scripts/sldd.sh.in            |   14 ++++----------
>  3 files changed, 12 insertions(+), 16 deletions(-)
> 
> diff --git a/opensm/scripts/opensm.init.in b/opensm/scripts/opensm.init.in
> index c31f017..52293eb 100644
> --- a/opensm/scripts/opensm.init.in
> +++ b/opensm/scripts/opensm.init.in
> @@ -53,13 +53,15 @@ if [[ -s /etc/rc.status ]]; then
>      failure() { rc_status -v; }
>      success() { rc_status -v; }
>  fi
> -if [[ -s /etc/sysconfig/opensm ]]; then
> -    . /etc/sysconfig/opensm
> +
> +CONFIG=@sysconfdir@/sysconfig/opensm
> +if [[ -s $CONFIG ]]; then
> +    . $CONFIG
>  fi
>  
>  start () {
>      echo -n "Starting opensm: "
> -    @sbindir@/opensm -B $OPTIONS > /dev/null
> +    @sbindir@/opensm --daemon $OPTIONS > /dev/null
>      if [[ $RETVAL -eq 0 ]]; then
>          touch /var/lock/subsys/opensm
>          success
> diff --git a/opensm/scripts/redhat-opensm.init.in b/opensm/scripts/redhat-opensm.init.in
> index aad783b..9c22275 100755
> --- a/opensm/scripts/redhat-opensm.init.in
> +++ b/opensm/scripts/redhat-opensm.init.in
> @@ -39,7 +39,7 @@
>  #  $Id: openib-1.0-opensm.init,v 1.5 2006/08/02 18:18:23 dledford Exp $
>  #
>  # processname: @sbindir@/opensm
> -# config: @sysconfdir@/sysconfig/opensm.conf
> +# config: @sysconfdir@/sysconfig/opensm
>  # pidfile: /var/run/opensm.pid
>  
>  prefix=@prefix@
> @@ -47,7 +47,7 @@ exec_prefix=@exec_prefix@
>  
>  . /etc/rc.d/init.d/functions
>  
> -CONFIG=@sysconfdir@/sysconfig/opensm.conf
> +CONFIG=@sysconfdir@/sysconfig/opensm
>  if [ -f $CONFIG ]; then
>      . $CONFIG
>  fi
> @@ -147,7 +147,7 @@ start()
>  
>          # Start opensm
>  	echo -n "Starting IB Subnet Manager"
> -        $prog --daemon ${HONORE_GUID2LID} > /dev/null
> +        $prog --daemon ${HONORE_GUID2LID} ${OPTIONS} > /dev/null
>          cnt=0; alive=0
>          while [ $cnt -lt 6 -a $alive -ne 1 ]; do
>  		echo -n ".";
> diff --git a/opensm/scripts/sldd.sh.in b/opensm/scripts/sldd.sh.in
> index edb1454..f7635fe 100755
> --- a/opensm/scripts/sldd.sh.in
> +++ b/opensm/scripts/sldd.sh.in
> @@ -42,18 +42,12 @@
>  prefix=@prefix@
>  exec_prefix=@exec_prefix@
>  
> -# config: @sysconfdir@/sysconfig/opensm.conf
> -
> -[ -f @sysconfdir@/sysconfig/opensm.conf ] && CONFIG=@sysconfdir@/sysconfig/opensm.conf
> -
> -SLDD_DEBUG=${SLDD_DEBUG:-0}
> -
> -if [ -z "$CONFIG" ]; then
> -	[ $SLDD_DEBUG -eq 1 ] && echo "Config file not found."
> -    	exit 0
> +CONFIG=@sysconfdir@/sysconfig/opensm
> +if [ -f $CONFIG ]; then
> +	. $CONFIG
>  fi
>  
> -. ${CONFIG}
> +SLDD_DEBUG=${SLDD_DEBUG:-0}
>  
>  CACHE_FILE=${CACHE_FILE:-/var/cache/opensm/guid2lid}
>  CACHE_DIR=$(dirname ${CACHE_FILE})




More information about the general mailing list