#!/bin/sh ### # SAPDB start/stop script. # written by Fabian Moerchen # version 0.2.3 ### # names of the database instances to be started seperated by spaces DATABASES="TST" # usernames and password DBMUSER=dbm DBMPWD=dbm # start webtools (1 for yes, 0 for no) WEBTOOLS=1 # configuration file for webtools WEBCONF=/usr/spool/sql/ini/WebAgent73.ini # use this for the tgz install PATH=/bin:/usr/bin:/usr/sapdb/depend/bin:/usr/sapdb/indep_prog/bin:/usr/sapdb/web/pgm # use this for the rpm install #PATH=/bin:/usr/bin:/opt/sapdb/depend/bin:/opt/sapdb/indep_prog/bin:/opt/sapdb/web/pgm export PATH case "$1" in start) echo -n "Starting SAPDB database server..." _o=`x_server start 2>&1` _test=`echo $_o | grep 10004` if [ "$_test" = "" ]; then echo "failed:" echo $_o _test=`echo $_o | grep 10107` if [ "$_test" = "" ]; then exit 1 else echo "Trying to continue..." fi else echo "ok" fi for _s in ${DATABASES} do echo -n "Starting SAPDB database instance $_s..." _o=`dbmcli -d $_s -u $DBMUSER,$DBMPWD db_warm 2>&1` _test=`echo $_o | grep OK` if [ "$_test" = "" ]; then echo "failed:" echo $_o else echo "ok" fi done if test $WEBTOOLS -eq 1 ; then echo -n "Starting SAPDB webtools..." wahttp -f $WEBCONF & #2>&1 >/dev/null & #sleep 1 _test=`pidof wahttp` if [ "$_test" = "" ]; then echo "failed!" else echo "ok" fi fi ;; stop) if test $WEBTOOLS -eq 1 ; then echo -n "Stopping SAPDB webtools..." killall wahttp > /dev/null 2>&1 _test=`pidof wahttp` if [ "$_test" != "" ]; then echo "failed!" else echo "ok" fi fi for _s in ${DATABASES} do echo -n "Stopping SAPDB database instance $_s..." _o=`dbmcli -d $_s -u $DBMUSER,$DBMPWD db_stop 2>&1` _test=`echo $_o | grep OK` if [ "$_test" = "" ]; then echo "failed:" echo $_o else echo "ok" fi done echo -n "Stopping SAPDB database server..." _o=`x_server stop 2>&1` _test=`echo $_o | grep 10005` if [ "$_test" = "" ]; then echo "failed:" echo $_o exit 1 else echo "ok" fi ;; restart|force-reload) sh $0 stop sh $0 start ;; *) echo "Usage: $0 {start|stop|restart|force-reload}" exit 1 ;; esac exit 0