Switch to standard view 
  Sybase logo
 
 
 



    #!/bin/sh.
    #
    # The service runs as root, and the default tmp directory for
    # root is likely /root/tmp. You can then set your users to the
    # have same value for ASTMP and share memory connections will
    # work.
    # Uncomment the following command may if you want shared memory
    # connections.
    #
    # export ASTMP=/tmp
    #
    . /opt/sybase/SYBSsa9/bin/asa_config.sh > /dev/null
    dbstop -c "uid=DBA;pwd=SQL;eng=ASA;CommLinks=tcpip" > /dev/null
The dbstop command in the example above references the ASA database started in the SQLAnywhereService.init file.
  •  
      gprintf "Attempting to start Adaptive Server Anywhere"
      echo $*
      /opt/sybase/SYBSsa9/SQLAnywhereService.init
      gprintf "Attempting to stop Adaptive Server Anywhere"
      /opt/sybase/SYBSsa9/SQLAnywhereService.fini
      gprintf "Attempting to restart Adaptive Server Anywhere"
      /opt/sybase/SYBSsa9/SQLAnywhereService.fini
      /opt/sybase/SYBSsa9/ SQLAnywhereService.init
    •  
        start
        ;;
        stop
        ;;
        restart
        ;;
            gprintf "Usage: %s {start|stop|restart}\n" "$0"
        exit 1
    • start)
      stop)
      restart|reload)
      *)
      esac
      exit 0
  • #!/bin/sh
    #
    # Startup script for Adaptive Server Anywhere Service
    #
    # chkconfig: 2345 20 80
    # description: SQL Anywhere's Adaptive Server Anywhere (dbsrv9)
    # is a SQL database server.
    # processname: dbsrv9

    # Source function library.
    . /etc/rc.d/init.d/functions

    # The following are brief examples of how to have SQL Anywhere
    # Start and stop from the system.

    start() {

    }
    stop() {
    }
    restart() {
    }

    case "$1" in

    chmod u+x SQLAnywhereService
    chkconfig -add SQLAnywhereService

Starting the database

The easiest way to start the database server is using a script. The following steps explain how to create a SQLAnywhereService.init file that starts the database.

To create a script to start the database

  1. Using a text editor, create a file in the SQL Anywhere install directory called SQLAnywhereService.init in your SQL Anywhere Studio installation directory (/opt/sybase/SYBSsa9 by default) with the following contents (note that the following text includes a command to start the asademo sample database):
  2. Customize the command to start your database as necessary. For information about command-line options, see the chapter "Running the Database Server" in the Adaptive Server Anywhere Database Administration Guide.

 

Stopping the database

You need a separate script to stop the database. The following instructions explain how to create a SQLAnywhereService.fini file that stops the database.

To create a script to stop the database

  1. Using a text editor, create a file in /opt/sybase/SYBSsa9/ named SQLAnywhereService.fini with the following contents:
  2. Customize the command to stop your database as necessary. For information about command-line options, see "Stopping the database server" in the chapter "Running the Database Server" in the Adaptive Server Anywhere Database Administration Guide.

 

Setting permissions for the service scripts

The SQLAnywhereService.fini and SQLAnywhereService.init executable for the root user using (when logged in as the root user):

 

Creating the contents of the service

To create the contents of the service

  1. Using the root account, create a file called SQLAnywhereService in the /etc/init.d directory with the following contents:
  2. Execute the following command to make this file executable for the root user (when logged in as root user):
  3. Add the service with the following command:

Testing the service

You can test the service by rebooting and connecting to the server with Interactive SQL (using only the connection parameters "uid=DBA;pwd=SQL;links=tcpip;eng=ASA").

Alternatively, if you set up ASTMP in a common location, your connection string could be "uid=DBA;pwd=SQL". You should see very brief messages on machine startup about "Attempting to start SQL Anywhere".

Instead of using the ASTMP environment variable to allow for shared memory connections, you can use the su command to have the database server run under a different user account from within the SQLAnywhereService.init script. This option is useful when only one user on the system needs to access the database.

Starting and stopping the service from the command line

You can start or stop the service from the command line as root if you issue the following commands:



Back to Top
© Copyright 2010, Sybase Inc.