Hi,

here's a script that I wrote for ReadHat 7.3. It is a mixture of the sapdb init script (for SuSE ?) and RedHat syslog script. It uses RedHat's /etc/functions and the attached /etc/sysconfig/sapdb and not /etc/rc.config, which is typical for SuSE Linux.

However I could not make it work with the deamon() and killproc() funtions that RedHat provides, because SAPDB uses x_server to start and stop its processes (vserver and niserver). I also wrote a little for-do loop to set the configured databases into warm/offline on startup/shutdown. For this to work, all databases have to use the same DBM password. But since the DBM user can have two passwords, this should be easy to do. (The password has to be in plain text in /etc/sysconfig/sapdb which might be a security problem!)

Maybe someone with better RedHat knowledge can verify this script.

Hope this helps,
Arne

Victor Batista wrote:
Hi!

Thanks for your reply. I know what you wrote. The problem is that the script isn?t compatible with chkconfig. I have the Links on each of the rc.N directories, I have a message on the logs that sapdb has started corretly ?rc: Starting sapdb74: succeeded?. Although the engine isn?t working, and I have to start it manually!!

How can I start the databases automatically too? Should I put dbmcli commands on the init script?

Some help would be really appreciated!!


Thanks in advance,

Victor Batista


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Sergio Samayoa
Sent: sexta-feira, 10 de Janeiro de 2003 20:34
To: [EMAIL PROTECTED]
Subject: Re: Scripts to start SapDB on RH 7.2


Check for script sapdb in /etc/init.d

You must create a link in the appropiate run level start directory (i dont remember well but I think that it is located in /etc/rc.x or /etc/init.d/rc.x where x is the run level) to start sapdb. Set this links with lower number that JBoss's script link.

"Victor Batista" <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> escribi� en el mensaje 003a01c2b8cd$48cc9a10$6501a8c0@mzecas">news:003a01c2b8cd$48cc9a10$6501a8c0@mzecas...

Hello!

Can any body send me the scripts to automatically start SAP
DB 7.4 on RedHat Linux 7.2.

I am running JBoss with SapDB. When JBoss starts, SapDB
must already be running, with the databases already started.

I would really appreciate help.


Thank you in advance,

Victor Batista


--
Institute of Shipping Economics and Logistics    http://www.isl.org/
Arne Gehlhaar                                mailto:[EMAIL PROTECTED]
Universitaetsallee GW1 Block A                phone:+49.421.22096.49
D-28359 Bremen, Germany                         fax:+49.421.22096.55
#!/bin/bash
#
# Copyright (c) 2001 SAP AG, Germany.
#
# Author: <[EMAIL PROTECTED]>
# adapted for RedHat Linux by: Arne Gehlhaar <[EMAIL PROTECTED]>
#
# sapdb        Start SAP DB communication server.
#
# chkconfig: 35 98 10
# description: SAP DB - The FREE Enterprise Open Source Database
### BEGIN INIT INFO
# Provides: SAP DB
# Required-Start: $remote_fs $syslog
# Required-Stop:  $remote_fs $syslog
# Default-Start:  3 5
# Default-Stop:   0 1 2 6
# Description:    Start SAP DB communication server.
### END INIT INFO

# Source function library.
. /etc/init.d/functions

# Source config
if [ -f /etc/sysconfig/sapdb ] ; then
        . /etc/sysconfig/sapdb
else
    exit 5
fi

RETVAL=0

umask 077

start() {
        echo -n "Starting sapdb services: "
        $X_SERVER start > /dev/null 2>&1 && echo_success || echo_failure
        RETVAL=$?
        echo
        if [ $RETVAL -eq 0 ]; then
            echo "Starting database instances: "
            for dbi in `$DBMCLI db_enum | grep offline | cut -f1 | sort -u`; do
                echo -n Starting $dbi
                $DBMCLI -d $dbi -u DBM,$PASSWORD db_warm > /dev/null && echo_success 
|| echo_failure
                echo
            done
        fi
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sapdb
        return $RETVAL
}       
stop() {
        fuser $IND_PROG_DBROOT/pgm/vserver > /dev/null 
        if [ $? -eq 0 ]; then
            echo "Stopping database instances: "
            for dbi in `$DBMCLI db_enum | grep running | cut -f1 | sort -u`; do
                echo -n Stopping $dbi
                $DBMCLI -d $dbi -u DBM,$PASSWORD db_offline > /dev/null && 
echo_success || echo_failure
                echo
            done
        fi
        echo -n "Shutting down sapdb services: "
        $X_SERVER stop > /dev/null 2>&1 && echo_success || echo_failure
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sapdb
        return $RETVAL
}
rhstatus() {
        status vserver
        [ $? -eq 0 ] && $DBMCLI db_enum | grep running
}
restart() {
        stop
        start
}       

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  status)
        rhstatus
        ;;
  restart|reload)
        restart
        ;;
  condrestart)
        [ -f /var/lock/subsys/sapdb ] && restart || :
        ;;
  *)
        echo $"Usage: $0 {start|stop|status|restart|condrestart}"
        exit 1
esac

exit $?

Attachment: etc_sysconfig_sapdb
Description: application/java-applet

Reply via email to