Version 6.3.13 for UNIX
 —  Installation on UNIX  —

Activating the Natural Web I/O Interface Daemon on UNIX

When a Natural Web I/O Interface daemon is used, a procedure to activate the daemon may be called during system startup.

The Natural installation process provides a Natural Web I/O Interface daemon start/stop service procedure. The name of the procedure will be generated depending on the $SAG directory and the Natural version.

Furthermore, the Natural installation process determines the platform automatically and prepares the system (V style or AIX) to execute the start/stop service procedure during start/stop of the system. Depending on the platform, the system directory for initialization and, if needed, the runlevel startup directories will be selected. The start/stop service procedure will be copied to the system directory for initialization and links will be created in the runlevel startup directories.

The Natural installation process installs the Natural Web I/O Interface daemon start/stop service as an optional feature. You can also set up this service manually as described below. This document covers the following topics:

To verify the operation of the Natural Web I/O Interface daemon, invoke a Natural Web I/O Interface client on Windows and connect to the system on which the server runs. Use the port that was specified when starting the Natural Web I/O Interface daemon.


Preparing the System V Style Startup Procedure

The procedure template nwosrvd.tpl in the $NATDIR/$NATVERS/INSTALL directory may be used to create a script which is used to invoke the Natural Web I/O Interface daemon during system startup.

The following table shows where the init.d and rc3.d directories are located on the various platforms. In the following description, init.d or rc3.d stand for the relevant path indicated below for the platform you are using.

Platform System Directory for Initialization Runlevel Startup Directory
Solaris /etc/init.d /etc/rc3.d
HP-UX /sbin/init.d /sbin/rc3.d
Linux /etc/init.d /etc/init.d/rc3.d or /etc/init.d/rc5.d

A sample copy of the Natural Web I/O Interface daemon start/stop procedure is shown below. It can be edited with a text editor.

To set up the system, proceed as described below:

  1. Log in as user "root".

  2. Copy the template nwosrvd.tpl to the init.d system directory and rename it, for example to sag1nwo63srv.

  3. If already available, create a backup copy of your current sag1nwo63srv file contained in the init.d directory (see the above table).

  4. Set the following environment variables in the sag1nwo63srv procedure:

    NATDIR Location where Natural was installed.
    NATVERS Natural version number.
    NATADM The login name of the Natural system administrator responsible for this Natural Web I/O Interface daemon. It is assumed that this administrator account is called "sag", and that the user ID is already known to the system. It does not have to be a user with root privileges.
    NWODIR Home directory of the product located at $NATDIR/$NATVERS/nwo.
    NWONODE Name of the node on which the Natural Web I/O Interface daemon is installed.
    NWO_SRVDCONF $NATDIR/nwo/$NWONODE/nwosrvd.conf

    Note:
    The Bourne shell does not allow blanks before and after the equals sign in the lines to be customized.

  5. Create a link "S99sag1nwo63srv" to the sag1nwo63srv procedure in the rc3.d directory.

You may create a link to the Natural Web I/O Interface daemon start/stop procedure in the runlevel 3 startup directory of your UNIX machine. The rc3.d directory contains several Bourne shell scripts or links to Bourne shell scripts that start with "S" followed by a number, for example "99". A lower number will be executed first. If you add a file or a link to this directory, the respective code is executed when the system changes to "multi-user mode".

Top of page

Preparing the AIX Startup Procedure

The procedure template nwosrvd.tpl in the $NATDIR/$NATVERS/INSTALL directory may be used to create a script which is used to invoke the Natural Web I/O Interface daemon during system startup.

To set up the system, proceed as described below:

  1. Log in as user "root".

  2. Copy the template nwosrvd.tpl to the etc system directory and rename it, for example to sag1nwo63srv.

  3. Set the following environment variables in the sag1nwo63srv procedure:

    NATDIR Location where Natural was installed.
    NATVERS Natural version number.
    NATADM The login name of the Natural system administrator responsible for this Natural Web I/O Interface daemon. It is assumed that this administrator account is called "sag", and that the user ID is already known to the system. It does not have to be a user with root privileges.
    NWODIR Home directory of the product located at $NATDIR/$NATVERS/nwo.
    NWONODE Name of the node on which Natural Web I/O Interface daemon is installed.
    NWO_SRVDCONF $NATDIR/nwo/$NWONODE/nwosrvd.conf

    Note:
    The Bourne shell does not allow blanks before and after the equals sign in the lines to be customized.

  4. The /etc/inittab file supplies the script to the init command's role as a general process dispatcher. Therefore, enter a record with the sag1nwo63srv script in the /etc/inittab file using the mkitab command. For example:

    mkitab "sag1nwo63srv:3:wait:/etc/sag1nwo63srv > dev/console"
  5. Verify your changes to make sure that the changes made consist only of those changes desired.

Top of page

Sample of a Natural Web I/O Interface Daemon Start/Stop Procedure

#!/bin/sh
#
# Copyright (c) 2007 Software AG, Germany. All rights reserved.
#
# Start/stop script for Web I/O Interface Daemon      
#
#===================================================================

#
# For a logfile see variable "logfile" below!!!
#

start_daemon ()
{
  echo "Starting Web I/O Interface Daemon ..."
  if [ "x$pid" = 'x' ]; then
     if [ -x "${nwosrvd}" ]; then
        . ${natenv} > /dev/null && ${nwosrvd} ${PORT} > $logfile 2>&1 &
     else
        exit 1
     fi
     sleep 2
     chmod 775 $logfile
     chown ${NATADM}: $logfile
     pid='ps -A -o pid= -o args= | grep $PORT | grep nwosrvd | grep -v grep | awk '{print $1}''
     if [ "x$pid" = 'x' ]; then
        echo "failed"
     else
        echo "done"
     fi
  else
     echo "skipped"  
  fi
}

stop_daemon ()
{
  echo "Stopping Web I/O Interface Daemon ..." 
  if [ "x$pid" != 'x' ]; then
     kill -TERM $pid  
     sleep 2
     ps -p $pid > /dev/null 2>&1
     pidstat="echo $?"
     if [ "$pidstat" != 0 ]; then
        echo "done"
     else
        echo "failed"
     fi
  else
     echo "skipped"
  fi
}


if [ ! -r /opt/softwareag/nat/v6320/INSTALL/natenv ] ; then
  echo "$0: Natenv not found!"
  exit 6
else
  natenv="/opt/softwareag/nat/v6320/INSTALL/natenv "
fi

SAG=/opt/softwareag                   # customize
export SAG                            # customize

NATDIR=/opt/softwareag/nat            # customize
NATVERS=v6320                         # customize
NATADM=sag                            # customize
NWODIR=/opt/softwareag/nat/v6320/nwo  # customize
NWONODE=computerName                  # customize
NWO_SRVDCONF=/opt/softwareag/nat/v6320/nwo/computerName/nwosrvd.conf  # customize
NWOTIMEOUT=0                          # customize

PORT=pnum                             # customize

export NATDIR NATVERS NWODIR NWONODE NWO_SRVDCONF NWOTIMEOUT PORT

# needed for longer output of the ps command on Linux
COLUMNS=500
# needed for the options -o or -f of the ps command on hp-ux
UNIX95=

nwosrvd=$NATDIR/$NATVERS/nwo/bin/nwosrvd
logfile=$NATDIR/nwo/$NWONODE/nwosrv_${PORT}.log
rfile=$NATDIR/nwo/$NWONODE/nwosrvd.conf

#look pid of the server running on port $PORT
pid=''
pid='ps -A -o pid= -o args= | grep $PORT | grep nwosrvd | grep -v grep | awk '{print $1}''
# Startup the daemon
case "$1" in
  start)
    start_daemon
    ;;
  stop)
    stop_daemon
    ;;
  *)
    echo "Usage: $0 {start|stop}"
    exit 1
    ;;
esac
#
#===================================================================
#

Top of page