Before configuring your operating system for automatic restart:
Before starting the server, define the environment variable LD_LIBRARY_PATH.
Add $SYBASE/product_name/lib first to LD_LIBRARY_PATH. If /usr/shlib comes before $SYBASE/product_name/lib in LD_LIBRARY_PATH, you may encounter unresolvable symbol errors.
Verify that all network resources are available before you start Adaptive Server or Backup Server. The server cannot start if the network is down.
Verify that the entry in the rc (run control) directory for restarting the server follows any commands for starting network operations.
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:
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.
#!/sbin/sh # 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 # SYBASE=/sybase/rel1151 RUNSERVER=RUN_REL1151_XYZ BSERVER=RUN_REL1151_XYZ_BACKUP PATH=/sbin:/usr/sbin:/usr/bin # export PATH SYBASE RUNSERVER BSERVER # case "$1" in 'start') 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}" ;; esac
Copy the script to the /sbin/init.d directory, using syntax like the following:
cp script_name /sbin/init.d/script_name
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.
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:
/sbin/rc3.d/S10syslog /sbin/rc3.d/S15nfs.server /sbin/rc3.d/S21rfs
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.