Starting servers when the operating system restarts

This section describes how to configure your operating system for automatic restart of Adaptive Server and Backup Server when the system restarts.

On production systems, Adaptive Server, Backup Server, and Monitor Server should restart automatically when the UNIX operating system starts. This is accomplished by making an entry for the server in the operating system start-up script.

Monitor Server must be listed after Adaptive Server in the start-up script. For more information on starting Monitor Server during the operating system restart, see the Monitor Server User’s Guide.

Before configuring your operating system for automatic restart:

  1. Define an environment variable, LD_LIBRARY_PATH, before starting the server.

  2. Add $SYBASE/product_name/lib first to the LD_LIBRARY_PATH. If /usr/shlib comes before $SYBASE/product_name/lib in LD_LIBRARY_PATH, you may encounter unresolvable symbol errors.

  3. Verify that all network resources are available before you start Adaptive Server or Backup Server. Your server cannot start if the network is down.

  4. Verify that the entry in the rc (run control) directory for restarting the server follows any commands for starting network operations.

  5. Designate a period of time for your server to wait before starting, by inserting a sleep command at the beginning of the linked runserver file you created. Slow start-up of network operations can prevent servers from starting, even when the commands are in the correct order in the rc directory.

To configure your operating system for automatic restart of Adaptive Server and Backup Server:

  1. Create a start-up script file like the following. The start-up file is a Bourne shell script. You must use Bourne shell conventions in this file, even if you use the C shell for other tasks.

     # start a SYBASE Adaptive Server on system reboot
     # set SYBASE to the path of the sybase directory
     # set RUNSERVER to the name of the runserver file
     #     for the Adaptive Server 
     # set BSERVER to the name of the runserver file 
     #     for the backup server
     case "$1" in
         echo "Starting Sybase Adaptive Server"
         nohup su sybase -c \
           "$SYBASE/$SYBASE_ASE/install/startserver -f
     $SYBASE/$SYBASE_ASE/install/$RUNSERVER >/dev/null &"
         echo "Starting Sybase Backup Server"
         nohup su sybase -c \
            "$SYBASE/$SYBASE_ASE/install/startserver -f $SYBASE/$SYBASE_ASE/install/$BSERVER >/dev/null &"
         echo "Usage:  $0 {start}"
  2. Copy the script to the /sbin/init.d directory, using syntax like the following:

    cp script_name /sbin/init.d/script_name
  3. Review the “initdefault” entry in the /etc/inittab file to determine the default run level for your operating system. The default run level is usually 2 or 3.

  4. Use the ln command to create a hard link from the runserver file to the appropriate run control (rc) directory, rc#, where # is the default run level obtained in step 3. For example:

    ln /sbin/init.d/script_name /sbin/rc#.d/S##script_name

    When you type the command to create the link, add an uppercase “S” and a two-digit sequence number preceding the name of the script file. “S” indicates a start-up file. The sequence number is necessary because files in the rc directory are executed in numeric order. This file should be executed last, so use a number that comes after all existing numbers in ASCII sort order.

    You can perform an ls command on the rc directory to view existing numbers. For example:

    ls /sbin/rc3.d/S* 

    returns the following results:


    If your script is named sybstart, type a command like the following:

    ln /sbin/init.d/sybstart /sbin/rc3.d/S99sybstart

    In this example, you can use any number greater than 21 in place of 99.