tdi command line wrapper

It's easier to wrap the tdisrvctrl utility with this script. This assume you've not changed the default password (a bad thing not to do!)

vim tdi

#!/bin/bash

COMMAND=$1
CONFIG=$2

# Help Block
EXPECTED_ARGS=1

if [ $# -lt $EXPECTED_ARGS ]
then
  echo 
  echo "  Error: No command specified. "
  echo "   "
  echo "  Usage: `basename $0` [command]       "
  echo "   "
  echo "    "
  echo "    Valid Commands:"
  echo "        list     "
  echo "        list-running"
  echo "        start    "
  echo "        run      "
  echo "        stop     "
  echo "        reload   "
  echo "    "
  echo "   To list all configs: "
  echo "        tdi list   "
  echo "    "
  echo "    "
  exit $E_BADARGS
fi


case $COMMAND in

"list") 
  /opt/IBM/TDI/V7.1.1/bin/tdisrvctl -T /opt/IBM/TDI/V7.1.1/serverapi/testadmin.jks -W administrator -K /opt/IBM/TDI/V7.1.1/serverapi/testadmin.jks -P administrator -v -h localhost -op report -l
  ;;
"list-running") 
  /opt/IBM/TDI/V7.1.1/bin/tdisrvctl -T /opt/IBM/TDI/V7.1.1/serverapi/testadmin.jks -W administrator -K /opt/IBM/TDI/V7.1.1/serverapi/testadmin.jks -P administrator -v -h localhost -op status -c all
;;
"start")
  /opt/IBM/TDI/V7.1.1/bin/tdisrvctl -T /opt/IBM/TDI/V7.1.1/serverapi/testadmin.jks -W administrator -K /opt/IBM/TDI/V7.1.1/serverapi/testadmin.jks -P administrator -v -h localhost -op start -c $CONFIG
  ;;
"run")
  /opt/IBM/TDI/V7.1.1/bin/tdisrvctl -T /opt/IBM/TDI/V7.1.1/serverapi/testadmin.jks -W administrator -K /opt/IBM/TDI/V7.1.1/serverapi/testadmin.jks -P administrator -v -h localhost -op start -c $CONFIG -r $ASSERMBLY
  ;;
"stop")
   /opt/IBM/TDI/V7.1.1/bin/tdisrvctl -T /opt/IBM/TDI/V7.1.1/serverapi/testadmin.jks -W administrator -K /opt/IBM/TDI/V7.1.1/serverapi/testadmin.jks -P administrator -v -h localhost -op stop -c $CONFIG
;;
"reload") 
     /opt/IBM/TDI/V7.1.1/bin/tdisrvctl -T /opt/IBM/TDI/V7.1.1/serverapi/testadmin.jks -W administrator -K /opt/IBM/TDI/V7.1.1/serverapi/testadmin.jks -P administrator -v -h localhost -op reload -c $CONFIG
;;
*)
  echo "Unkown Option"
  ;;

esac

exit 0
Comments