Starting and Stopping the InterBase Server on UNIX

From InterBase
Jump to: navigation, search

Go Up to Server Configuration


The following sections describe how to start and stop the InterBase server on UNIX.

Using ibmgr to Start and Stop the Server

The InterBase Server and InterBase Guardian must be started before you enable database connections. On Windows platforms, you can use the InterBase Manager to start and stop the InterBase Server and Guardian. In previous versions of InterBase the InterBase Manager is a Windows Control Panel applet. Now the InterBase Manager is an application installed for each instance of the InterBase Server installed. To start the InterBase Manager, choose Start > Programs > InterBase install directory. You can use InterBase Manager to do the following:

  • Choose the server startup mode: whether to start the InterBase server manually, or have it start automatically at system boot time.
  • Change the path to the server: if you click the Change option, you can browse and select a different directory.
  • Change how InterBase Server operates. By default, InterBase runs automatically as a service on Windows platforms, though it is possible (but not recommended) to run it as an application.
Note: To start InterBase Server as an application from a command prompt or in a batch file, invoke InterBase Guardian with the following options:
ibguard -a -p service_name -i interbase_env_variable

Options: Start and Stop InterBase Commands are:

Command/option Description

-a

Start as application

-i

Environment variable; identifies the Server location for clients that want to connect locally to the Server.

-p

Port number; where the <service_name> is the entry in the services file pointing to the port number where InterBase Server listens for connection requests from clients.

InterBase Guardian starts the server, and places an icon in the System Tray.

  • Start InterBase Server and InterBase Guardian, via a Start/Stop button. Click Start in the InterBase Manager Status area to start InterBase Server (and InterBase Guardian). The server status changes, and an InterBase Guardian icon appears in the system tray. Once you have started the InterBase Server, you can exit InterBase Manager, and both InterBase Server and InterBase Guardian will continue to run. The InterBase Guardian icon remains in the System Tray until you stop the server.
  • Stop InterBase Server and InterBase Guardian, via a Start/Stop button. Click Stop in the InterBase Manager Status area to stop InterBase Server (and InterBase Guardian). Or, right-click the InterBase Guardian icon in the System Tray and choose Shutdown.

Starting the Server

To start the InterBase server, log in as the “root” or “interbase” user. (“interbase” is a synonym for “InterBase,” to accommodate operating systems that do not support nine-character account names.) For example, start InterBase with the following command:

ibmgr -start -p service_name
Note: Once you have started ibserver using one login, such as “root,” be aware that all objects created belong to that login. They are not accessible to you if you later start ibserver as one of the other two (“interbas” or “InterBase”). It is highly recommended to run the InterBase Server as “InterBase.” If the -p option is not specified, the default of gds_db is used.

Stopping the Server

Note: For safety, make sure all databases have been disconnected before you stop the server.

The command switches -user and -password can be used as option switches for commands like -start or -shut. For example, you can shut down a server in any of the following ways:

ibmgr -shut -password password

or

ibmgr u
IBMGR> shut -password password

or

imbgr u
IBMGR> password password
IBMGR> shut
Note: The -shut option rolls back all current transactions and shuts down the server immediately. If you need to allow clients a grace period to complete work and detach gracefully, use shutdown methods for individual databases. See Shutting Down and Restarting Databases.

Starting the Server Automatically

To configure a UNIX server to start the InterBase Server automatically at server host boot-time, you must install a script that the rc initialization scripts can run. Refer to /etc/init.d/README for more details on how UNIX runs scripts at boot-time.

Example initialization script:

#!/bin/sh
# ibserver.sh script - Start/stop the InterBase daemon
# Set these environment variables if and only if they are not set.
: ${InterBase:=/usr/interbase}
# WARNING: in a real-world installation, you should not put the
# SYSDBA password in a publicly-readable file. To protect it:
# chmod 700 ibserver.sh; chown root ibserver.sh
export InterBase

ibserver_start() {
 # This example assumes the InterBase server is
# being started as UNIX user ’InterBase’.
echo ‘$InterBase/bin/ibmgr -start -forever’ |su InterBase
}

ibserver_stop() {
 # No need to su.
$InterBase/bin/ibmgr -shut -user SYSDBA -password password
}

case $1 in
’start’) ibserver_start ;;
’start_msg’) echo 'InterBase Server starting...\c' ;;

’stop’) ibserver_stop ;;
’stop_msg’) echo 'InterBase Server stopping...\c' ;;

*) echo 'Usage: $0 { start | stop }' ; exit 1 ;;
esac

exit 0

Example initialization script installation on Solaris:

1. Log in as root.
$ su
2. Enter the example script above into the initialization script directory.
# vi /etc/init.d/ibserver.sh
3. Enter text.
4. Link the initialization script into the rc directories for the appropriate run levels for starting and stopping the InterBase server.
# ln /etc/init.d/ibserver.sh /etc/rc0.d/K30ibserver
# ln /etc/init.d/ibserver.sh /etc/rc2.d/S85ibserver

Example initialization script installation on Linux:

1. Log in as root.
$ su
2. Enter the Linux example script (given below) into the initialization script directory.
# cp ibserver.sh /etc/rc.d/init.d/ibserver.sh
# chmod 700 /etc/rc.d/init.d/ibserver.sh
3. Link the initialization script into the rc directories for the appropriate run levels for starting the InterBase server.
# ln -s /etc/rc.d/init.d/ibserver.sh /etc/rc.d/rc0.d/S85ibserver
4. Link the initialization script into the rc directories for the appropriate run levels for stopping the InterBase server.
# ln -s /etc/rc.d/init.d/ibserver.sh /etc/rc.d/rc0.d/K30ibserver
5. Make sure you have host equivalence.
# touch /etc/gds_hosts.equiv
# echo “+” >> /etc/gds_hosts.equiv
6. Make sure you do not have an inetd entry for InterBase Classic.
# echo -e “/gds_db/s/^/#/\nwq” | ed /etc/inetd.conf
# killall -HUP inetd

Example Linux initialization script:

#!/bin/sh
# ibserver.sh script - Start/stop the InterBase daemon
# Set these environment variables if and only if they are not set.
: ${InterBase:=/usr/interbase}
# WARNING: in a real-world installation, you should not put the
# SYSDBA password in a publicly-readable file. To protect it:
# chmod 700 ibserver.sh; chown root ibserver.sh
export InterBase

ibserver_start() {
 # This example assumes the InterBase server is
# being started as user “InterBase”.
su - InterBase -c “$InterBase/bin/ibmgr -start -forever”
RETVAL=$?
[ $RETVAL -eq 0 ] && touch //lock/subsys/ibserver
}

ibserver_stop() {
 # No need to su.
$InterBase/bin/ibmgr -shut -user SYSDBA -password password
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f //lock/subsys/ibserver
}

if [ ! -d “$InterBase” ] ; then
echo “$0: cannot find InterBase installed at $InterBase” >&2
exit 1
fi
if [ ! -x “$InterBase/bin/ibmgr” ] ; then
echo “$0: cannot find the InterBase SuperServer manager as
$InterBase/bin/ibmgr” >&2
if [ ! -x “$InterBase/bin/gds_inet_server” ] ; then
echo “$0: this is InterBase Classic; use inetd instead of
ibserver daemon” >&2
fi
exit1
fi

case $1 in
’start’)
ibserver_start ;
echo “InterBase started” ;;
’start_msg’)
echo 'InterBase Server starting...\c' ;;

’stop’)
ibserver_stop ;
echo “InterBase stopped” ;;
’stop_msg’)
echo 'InterBase Server stopping...\c' ;;

’restart’)
ibserver_stop ; ibserver_start
echo “InterBase restarted” ;;
’restart_msg’)
echo 'InterBase Server restarting...\c' ;;

*) echo “Usage: $0 { start | stop | restart }” ; exit 1 ;;
esac

exit 0