Best procedure to stop Db - Linux Reboot - start db

OOsorio

New Member
When doing a Linux reboot, what would be the recommended procedure to AUTOMATICALLY stop the db prior to reboot and start the db after reboot?
 

TomBascom

Curmudgeon
Create some scripts that go in the proper /etc/init.d directories and which respond to at least the "start", "stop" and "status" queries.

A little fishing around in the directory should turn up an example or two in short order but here's one that I use on SUSE:

Code:
#!/bin/sh
#
# /etc/init.d/sports2000
#
# to automatically start & stop @ boot/shutdown:
#
#       ln -s sports2000 rc3.d/S99sports2000
#       ln -s sports2000 rc3.d/K00sports2000
#       ln -s sports2000 rc5.d/S99sports2000
#       ln -s sports2000 rc5.d/K00sports2000
#
### BEGIN INIT INFO
# Provides:          sports2000
# Required-Start:
# Required-Stop:
# Default-Start:     3 5
# Default-Stop:      0 1 2 4 6
# Description: sports2000 - sports2000 database server
### END INIT INFO

echo $* >> /tmp/sports2000.err

. /etc/rc.status                # this causes "ps" output to be truncated

rc_reset

umask 0

case "$1" in
    start)
        echo -n "Starting sports2000 "
        /data/sports2000/startdb >> /tmp/sports2000.err 2>&1
        rc_status -v
        ;;
    stop)
        echo -n "Shutting down sports2000 "
        /data/sports2000/stopdb >> /tmp/sports2000.err 2>&1
        rc_status -v
        ;;
    status)
        echo -n "Checking for service sports2000 "
        export COLUMNS=255
        ps -ef | grep _mprosrv | grep "sports2000 -pf db.pf" >> /tmp/sports2000.err 2>&1
        rc_status -v
        ;;
    *)
        echo "Usage: $0 {start|stop|status}"
        exit 1
        ;;
esac

rc_exit
 

OOsorio

New Member
I thought PROENV had to be running for the db to work? If not, in a nutshell, what is the purpose of PROENV?
 

OOsorio

New Member
Can I assume that the database will run fine even though I don't execute proenv before starting the database?
 

TomBascom

Curmudgeon
PROENV is just a simple little wrapper script that makes sure that your environment variables are set properly. Go ahead and read it with your favorite text editor, it's nothing magic.

I, personally, only ever use it if I'm on a Windows box that has multiple versions of Progress installed. And even then only if normal command line stuff isn't working correctly.
 
Top