This section provides an example of a script for starting, stopping, restarting, and obtaining the status of a Sybase database cluster service.
You need to modify this script to use the correct Sybase database and server names for your environment. In addition, in the following line, change the definition of BasePath to point to the configuration file for your Sybase installation.
. ${BasePath:=/branch}/cfg/zbranch.cfg |
Under the installed Sybase directory (/opt/sybase by default), the Interfaces file contains the IP addresses to which the Sybase database server and backup server should bind. Ensure that the Interfaces file includes the floating service IP address for the Sybase service.
To use this script, issue the following commands:
sybase start—Starts the Sybase service
sybase stop—Stops the Sybase service
sybase restart—Retarts the Sybase service (from a stopped state)
sybase status—Reports the status of the Sybase service
![]() | Note |
---|---|
This script has been contributed by the Red Hat user community; it has not been tested by Red Hat and is unsupported. |
#!/bin/sh # Startup script for Sybase # Edited by Sherif Abdelgawad (sabdelg@redhat.com) # Customized for AS2.1 Failover. Note: /opt/sybase/interfaces # must point to the floating IP address. # # sybase: Starts the available servers # # Version: @(#) /etc/rc.d/init.d/sybase 1.2 # # chkconfig: 345 85 15 # # description: This script will browse through the /opt/sybase/install \ # directory and launch all servers configured from this location. # SERVERS="dataserver backupserver" # Source function library. . /etc/rc.d/init.d/functions . ${BasePath:=/branch}/cfg/zbranch.cfg if [ -n "${SYBASE}" -a -d "${SYBASE}" ]; then PATH="${SYBASE}/bin:${SYBASE}/install:${PATH}" export SYBASE PATH # See how we were called. case "$1" in start) ## ## echo "Starting SIS sybase module" PXXX=`cat /home/sybase/init/server.p` RFILE=$SYBASE/install/RUN_${SybInst} BFILE=$SYBASE/install/RUN_${SybInst}_BS su - sybase -c "$SYBASE/install/startserver -f $BFILE >/dev/null &" sleep 45 su - sybase -c "$SYBASE/install/startserver -f $RFILE >/dev/null &" ## ## touch /var/lock/subsys/sybase ;; stop) # Because we send a message to the database server (as opposed to # the local node), we need to ensure that the database server is # running locally so that we do not send a message to the other # node when an administrator (or Red Hat Cluster Manager) types # "service sybase stop" on this node. $0 status &> /dev/null rv=$? if [ $rv -eq 3 ]; then # Not running locally. exit 0 fi echo -n "Shutting down SIS sybase module" PXXX=`cat /home/sybase/init/server.p` SFILE=/home/sybase/init/shutdown.sql su - sybase -c "isql -Usa -P$PXXX -S$SybInst -i$SFILE >/dev/null &" ## ## rm -f /var/lock/subsys/sybase ;; status) # Use the Red Hat Linux status command to grab and display the # status of the servers. If both of the servers are not # running, the status command returns 3. If one is not running, # this is assumed to be an error state and 1 is returned. rc=0 total=0 for s in $SERVERS; do ((total++)) status $s if [ $? -eq 0 ]; then ((rc++)) fi done if [ $rc -ne $total -a $rc -ne 0 ]; then # Number of servers running != total. Return error. exit 1 elif [ $rc -eq 0 ]; then # No servers running. This is okay; status 3. exit 3 fi ;; restart) $0 stop $0 start ;; *) echo "*** Usage: sybase {start|stop|status|restart}" exit 1 esac fi exit |