#!/bin/sh # This script toggles the nsagent client.conf hold_queue value between 0 and 1 # # get command line parm and show help screen #if [ -z $1 ] ; then # echo #else comparm=`echo $1` case $comparm in -h|-i) echo echo 'USAGE:' echo ' This utility requires root privileges or the use of sudo.' echo ' No other parameters are required. "-h" or "-i" will show this help screen.' echo ' The value of the hold_queue parameter will toggle between 0 and 1 each time this script is ran.' echo ' Example: "sudo '$0'"' echo exit 0 #fi esac # # case `uname -s` in *[Dd]arwin*) OSTYPE=Darwin ;; *) OSTYPE=other ;; esac # # # get path to the client.conf file from client.conf using aex-helper - works on unix, linux & mac conf_file=`aex-helper query config` echo 'Path to client.conf is: ' $conf_file # # curVal=`grep hold_queue= $conf_file | awk 'BEGIN { FS="="; } { print $2 }'` echo "hold_queue was set to: " $curVal # # if [ $OSTYPE == 'Darwin' ] ; then if [ $curVal == 0 ] ; then sedCmd="sed -i prevholdq s/hold_queue=0/hold_queue=1/ $conf_file" else sedCmd="sed -i prevholdq s/hold_queue=1/hold_queue=0/ $conf_file" fi else if [ $curVal == 0 ] ; then sedCmd="sed -iprevholdq s/hold_queue=0/hold_queue=1/ $conf_file" else sedCmd="sed -iprevholdq s/hold_queue=1/hold_queue=0/ $conf_file" fi fi # `$sedCmd` # # curVal=`grep hold_queue= $conf_file | awk 'BEGIN { FS="="; } { print $2 }'` echo "hold_queue is now set to: " $curVal