Auto start of sybase

CAn anyone describe how to make Sybase automatically start at boot of a linux system.
CoatesAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jkotekCommented:
The question of starting the Sybase database is a question of running apropriate script.

In case of Adaptive Server Enterprise it is the command 'startserver -fRUN_servername' from $SYBASE/install directory. You can make a simple script executing this command and put it in apropriate runlevel init directory -
in /etc/rcN.d are scripts that are executed by entering runlevel N - scripts starts with S or K followed by a two digit number - the S scripts start something (NFS daemon...) and have word 'start' parameter and the K scripts are stopping something (their parameter is 'stop'.
The numbers are for ordering of these scripts.

So all you have to do is to create a script containing the 'stratserver...' command, name it S99ASE and put it in the correct rc directory (rc5.d ?)

And also don't forget to create stopping scripts for other rc dirs.

Linux however uses for all its 'services' one generic script for starting and stoping (action is choosen according to the 'start' or 'stop' parameter) - located in /etc/init.d dir. The rcN.d dirs then contain only apropriately renamed links to this start/stop script.

The Adaptive Server Anywhere has a different startup command (dbsrv6 -n <name> ...). Usage is same.
0
amitpagarwalCommented:
Q1.1: How to start/stop SQL Server when CPU reboots

--------------------------------------------------------------------------------
Below is an example of the various files (on Irix) that are needed to start/stop a SQL Server. The information can easily be extended to any UNIX platform.
The idea is to allow as much flexibility to the two classes of administrators that admin the machine:

The System Administrator
The Database Administrator
Any errors introduced by the DBA will not interfere with the System Administrator's job.
With that in mind we have the system startup/shutdown file /etc/init.d/sybase invoking a script defined by the DBA: /usr/sybase/sys.config/{start,stop}.sybase

/etc/init.d/sybase
On some operating systems this file must be linked to a corresponding entry in /etc/rc.0 and /etc/rc.2 -- see rc0(1M) and rc2(1M)
#!/bin/sh
# last modified:  10/17/95, sr.
#
# Make symbolic links so this file will be called during system stop/start.
# ln -s /etc/init.d/sybase /etc/rc0.d/K19sybase
# ln -s /etc/init.d/sybase /etc/rc2.d/S99sybase
# chkconfig -f sybase on

# Sybase System-wide configuration files
CONFIG=/usr/sybase/sys.config

if $IS_ON verbose ; then        # For a verbose startup and shutdown
        ECHO=echo
        VERBOSE=-v
else                            # For a quiet startup and shutdown
        ECHO=:
        VERBOSE=
fi

case "$1" in
'start')
        if $IS_ON sybase; then
                if [ -x $CONFIG/start.sybase ]; then
                   $ECHO "starting Sybase servers"
                   /bin/su - sybase -c "$CONFIG/start.sybase $VERBOSE &"
                else
               <error condition>
                fi
        fi
        ;;

'stop')
        if $IS_ON sybase; then
                if [ -x $CONFIG/stop.sybase ]; then
                   $ECHO "stopping Sybase servers"
                   /bin/su - sybase -c "$CONFIG/stop.sybase $VERBOSE &"
                else
               <error condition>
                fi
        fi
        ;;

*)
        echo "usage: $0 {start|stop}"
        ;;
esac

/usr/sybase/sys.config/{start,stop}.sybase
start.sybase
#!/bin/sh -a

#
# Script to start sybase
#
# NOTE: different versions of sybase exist under /usr/sybase/{version}
#

# Determine if we need to spew our output
if [ "$1" != "spew" ] ; then
   OUTPUT=">/dev/null 2>&1"
else
   OUTPUT=""
fi

# 10.0.2 servers
HOME=/usr/sybase/10.0.2
cd $HOME

# Start the backup server
eval install/startserver -f install/RUN_BU_KEPLER_1002_52_01 $OUTPUT

# Start the dataservers
# Wait two seconds between starts to minimize trauma to CPU server
eval install/startserver -f install/RUN_FAC_WWOPR $OUTPUT
sleep 2
eval install/startserver -f install/RUN_MAG_LOAD $OUTPUT

exit 0

stop.sybase
#!/bin/sh

#
# Script to stop sybase
#

# Determine if we need to spew our output
if [ -z "$1" ] ; then
   OUTPUT=">/dev/null 2>&1"
else
   OUTPUT="-v"
fi

eval killall -15 $OUTPUT dataserver backupserver sybmultbuf
sleep 2

# if they didn't die, kill 'em now...
eval killall -9 $OUTPUT dataserver backupserver sybmultbuf

exit 0


If your platform doesn't support killall, it can easily be simulated as follows:
   #!/bin/sh

   #
   # Simple killall simulation...
   #    $1 = signal
   #    $2 = process_name
   #

   #
   # no error checking but assume first parameter is signal...
   # what ya want for free?  :-)
   #

   kill -$1 `ps -ef | fgrep $2 | fgrep -v fgrep | awk '{ print $1 }'`



- I got this from Sybase FAQ (ftp://sgigate.sgi.com/pub/Sybase_FAQ/FAQ_txt.Z)

-Thanks
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Sybase Database

From novice to tech pro — start learning today.