#!/usr/bin/ksh # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # bos720 src/bos/usr/sbin/ewlmcfg/ewlm_chconfig.sh 1.1 # # Licensed Materials - Property of IBM # # Restricted Materials of IBM # # COPYRIGHT International Business Machines Corp. 2003 # All Rights Reserved # # US Government Users Restricted Rights - Use, duplication or # disclosure restricted by GSA ADP Schedule Contract with IBM Corp. # # IBM_PROLOG_END_TAG # @(#)85 1.1 src/bos/usr/sbin/ewlmcfg/ewlm_chconfig.sh, cmdewlm, bos720 12/18/03 15:25:00 # # COMPONENT_NAME: cmdewlm (eWorkload Management) # # FUNCTION: ewlm_chconfig # # ORIGINS: 27 # # DESCRIPTION: # changes configuration attributes # syntax: ewlm_chgconfig -a attr=value [ -a attr=value ... ] # This command is not supposed to be executed directly and is not # fool proof. # Customization should be done using SMIT (fastpath ewlm). # export PATH=/usr/bin:/usr/sbin:/sbin:$PATH MSGSET=3 MSGCAT=ewlm.cat MESSAGE="dspmsg -s $MSGSET $MSGCAT" cleanup() { trap '' 1 2 15 rm -f /tmp/_inp$$ /tmp/_out$$ /tmp/_aa_$$ exit 1 } chg_parm() { awk -v arg=$1 ' BEGIN { i = split(arg, A, /\=/); if (i < 2) exit 1; } { if (substr($1, 1 1) == "#") { print; next; } if ($1 == A[1]) { printf ("%s\t=\t%s\t", $1, A[2]); found++; j = 4; if (substr($3, 1, 1) == "#") j = 3; for (i=j; i<= NF; i++) printf("%s ", $i); printf("\n"); next; } print; } END { if (found) exit 0; else exit 1; } ' <$2 >$3 if [ $? -ne 0 ] then $MESSAGE 2 'Unknown attribute name in parameter "%s"\n' $1 fi } usage () { # Usage: # ewlm_chconfig <limits | config> -a attr=value [ -a attr=value [ ... ] ] $MESSAGE 1 '\nIncorrect Syntax - This command is for use by SMIT only\n' } # main script DEFAULT_DIR=/etc/ewlm CONFIG_DIR=$DEFAULT_DIR LIMITS_FILE=limits BINDIR=/usr/sbin trap 'cleanup' 1 2 15 case $1 in limits) FILE=$LIMITS_FILE;; *) usage; exit 1;; esac shift; if [ "$1" = "-d" ] then CONFIG_DIR=$2 shift shift fi FILE=$CONFIG_DIR/$FILE USER=`id -u` if [ $USER -ne 0 ] then $MESSAGE 3 'Root authority is required to configure EWLM.\n' exit 1 fi if [ ! -f $FILE ] then # config file does not exist. # create it. cat >$FILE << EOF! # @(#)20 1.1 src/bos/etc/ewlm/limits, sysewlm, bos52F 11/18/03 17:16:53 # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # bos52F src/bos/etc/ewlm/limits 1.1 # # Licensed Materials - Property of IBM # # (C) COPYRIGHT International Business Machines Corp. 2003 # All Rights Reserved # # US Government Users Restricted Rights - Use, duplication or # disclosure restricted by GSA ADP Schedule Contract with IBM Corp. # # IBM_PROLOG_END_TAG # # COMPONENT_NAME: ewlm (eWorkload Management) # # ORIGINS: 27 # # # This file defines the maximun limits enforced by the # eWLM ARM services layer. # The format is: # <keyword> = <value> # The values can be changed by editing this file. # The keywords cannot be modified. # The comment character is "#" # Empty lines or lines with unrecognized keywords will be ignored. # If a keyword appears more than once, only the last value will be used. max_register_applications = 1024 max_register_applications_per_process = 256 max_start_applications = 2048 max_start_applications_per_register_application = 256 max_start_applications_per_process = 256 max_start_transactions = 65536 max_start_transactions_per_process = 16384 max_arm_blocks_per_transaction = 256 max_arm_binds_per_transaction = 256 max_register_transactions = 4096 max_register_transactions_per_register_application = 256 max_register_transactions_per_process = 256 max_ewlm_storage = 67108864 completion_buffer_size = 65536 ewlm_managed_server_component_priority = 39 EOF! fi set -- `getopt a:nb $*` if [ $? != 0 ] then usage exit 1 fi cp $FILE /tmp/_inp$$ action="" afound="n" while [ $1 != -- ] do case $1 in -a) afound="y"; chg_parm $2 /tmp/_inp$$ /tmp/_out$$ mv /tmp/_out$$ /tmp/_inp$$ shift; shift;; *) action=$1 shift;; esac done cp /tmp/_inp$$ $FILE #if changes to be applied "now" start modify method RC=0 if [ "$action" = "-n" ] && [ "$afound" = "y" ] then /usr/sbin/ewlmcfg -m 2>/tmp/_aa_$$ RC=$? fi if [ $RC -eq 7 ] then $MESSAGE 4 'EWLM is disabled. The new configuration will be used when EWLM is enabled.\n' RC=0 fi if [ $RC -ne 0 ] then $MESSAGE 5 'An error occurred when setting the new limits:\n' cat /tmp/_aa_$$ fi rm -f /tmp/_inp$$ /tmp/_out$$ /tmp/_aa_$$ exit $RC