Installing and Configuring the SMF Script

  1. Stop IBM® Connect:Direct® using the Command Line Interface (CLI). For information, refer to IBM Sterling Connect:Direct for UNIX User Guide.
  2. As root, copy the following Bourne shell script file to /lib/svc/method/connect-direct.
    #!/sbin/sh

    #

    # /lib/svc/method/connect-direct

    #

    # For Solaris SMF. This file goes in /lib/svc/method/

    # Please set the top three variables before using this script.

    # Notes:The CDunix Admin ID is needed below because SMF scripts are run as root at

    # system boot and shutdown. And since the root ID is not in the Connect:Direct

    # userfile.cfg, the root ID does not have permission to "stop" C:D.

    # We don't want to put the root ID in the userfile.cfg just to get around this.

    # So we su to the CDunix Admin ID that installed Connect:Direct, (or su to an

    # ID with permissions to stop Connect:Direct). Then issue the Direct CLI

    # command to stop the Connect:Direct service.

    # Also, a "stop force;" is given in the Connect:Direct CLI in order to have

    # Connect:Direct do an immediate clean stop. A simple "stop;" would wait for

    # currently running Connect:Direct jobs to complete. However, the OS is not

    # going to wait for C:D to complete long running jobs. Instead, after a few

    # moments the OS would finally kill the cdpmgr, which is generally not what we

    # want. However, using a "stop force;" the cdpmgr will take a checkpoint of

    # job progress and cleanly shut down. Then after Connect:Direct restarts it

    # will pick up from that last checkpoint.

    # For further questions about this script, contact Sterling Commerce Customer Support.

    . /lib/svc/share/smf_include.sh

    # Installation path

    CDUNIX_HOME=/opt/cdunix

    # Name of this Connect:Direct instance.

    CDUNIX_NODE_NAME=chicago_CD

    # The ID that installed Connect:Direct or an ID with authority to issue

    # the "stop" command.

    CDUNIX_ADMIN=jsmith

    # Do not change the remainder of this file unless you require different behavior.

    startup()

    {

    INITPARM_CONF=${CDUNIX_HOME}/ndm/cfg/${CDUNIX_NODE_NAME}/initparm.cfg

    [ ! -f ${INITPARM_CONF} ] && exit $SMF_EXIT_ERR_CONFIG

    [ ! -x ${CDUNIX_HOME}/ndm/bin/cdpmgr ] && exit $SMF_EXIT_ERR_PERM

    exec ${CDUNIX_HOME}/ndm/bin/cdpmgr -i ${INITPARM_CONF} 2>&1

    }

    shutdown()

    {

    [ ! -f ${CDUNIX_HOME}/ndm/cfg/cliapi/ndmapi.cfg ] && \

    exit $SMF_EXIT_ERR_CONFIG

    # Don't exec this. C:D may already be down. If so, CLI returns 8

    # and SMF will then put us in "maintenance" mode.

    su ${CDUNIX_ADMIN} -c \

    "NDMAPICFG=${CDUNIX_HOME}/ndm/cfg/cliapi/ndmapi.cfg; \

    export NDMAPICFG; \

    echo 'stop force;' | ${CDUNIX_HOME}/ndm/bin/direct" 2>&1

    }

    case "$1" in

    start)

    startup

    ;;

    stop)

    shutdown

    exit 0

    ;;

    refresh|restart)

            shutdown

    startup

    ;;

    *)

    echo "Usage: $0 {start|stop|restart}"

    exit 1

    ;;

    esac

  3. To match your installation, edit the following shell variables: CDUNIX-HOME, CDUNIX_NODE_NAME, and CDUNIX_ADMIN.
  4. Verify that the owner and permissions of this script file match those of the other scripts in the /lib/svc/method directory.
  5. To test the /lib/svc/method/connect-direct script:
    1. Change to the /lib/svc/method/ directory.
    2. As root, start the Sterling Connect:Direct service by typing the following command:./connect-direct start
    3. Verify that the Sterling Connect:Direct service is running.
    4. As root, stop the Sterling Connect:Direct service by typing the following command:./connect-direct stop
    5. Verify that the Sterling Connect:Direct service stopped.
  6. As root, copy the SMF Service Manifest in the following sample to /var/svc/manifest/application/connect-direct.xml.
    <?xml version="1.0"?>
    <!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
    <!--
      Example SMF Service manifest for Connect:Direct for UNIX on Solaris.
    -->
    <service_bundle type='manifest' name='Connect:Direct'>
    <service
            name='application/connect-direct'
            type='service'
            version='1'>
            <!--
              If we have multiple instances of application/connect-direct provided
              by different licensed implementations, we keep dependencies
              and methods within the instance.
            -->
            <instance name='default' enabled='false'>
                    <!--
                      Wait for network interfaces to be initialized.
                    -->
                    <dependency name='network'
                        grouping='require_all'
                        restart_on='error'
                        type='service'>
                        <service_fmri value='svc:/milestone/network:default'/>
                    </dependency>
                    <!--
                      Wait for all local filesystems to be mounted.
                    -->
                    <dependency name='filesystem-local'
                        grouping='require_all'
                        restart_on='none'
                        type='service'>
                        <service_fmri
                            value='svc:/system/filesystem/local:default'/>
                    </dependency>
                    <!--
                      Wait for automounting to be available, as we may be
                      transfering data from home directories or other remote
                      filesystems.
                    -->
                    <dependency name='autofs'
                        grouping='optional_all' restart_on='error'
                        type='service'>
                        <service_fmri
                            value='svc:/system/filesystem/autofs:default'/>
                    </dependency>
                    <exec_method
                            type='method'
                            name='start'
                            exec='/lib/svc/method/connect-direct start'
                            timeout_seconds='30' >
                            <method_context>
                                     <method_credential user='root' group='root' />
                            </method_context>
                    </exec_method>
                    <exec_method
                            type='method'
                            name='stop'
                            exec='/lib/svc/method/connect-direct stop'
                            timeout_seconds='30' >
                            <method_context>
                                    <method_credential user='root' group='root' />
                            </method_context>
                    </exec_method>
    
                    <exec_method
                            type='method'
                            name='refresh'
                            exec='/lib/svc/method/connect-direct restart'
                            timeout_seconds='45' >
                            <method_context>
                                    <method_credential user='root' group='root' />
                            </method_context>
                    </exec_method>
                    <property_group name='cdpmgr' type='application'>
                            <stability value='Evolving' />
                    </property_group>
                    <property_group name='startd' type='framework'>
                            <propval name='ignore_error'
                                     type='astring'
                                     value='core,signal' />
                    </property_group>
                    <property_group name='general' type='framework'>
                            <propval name='action_authorization' type='astring' 
                               value='solaris.smf.manage.connect-direct' />
                            <propval name='value_authorization'  type='astring' 
                               value='solaris.smf.manage.connect-direct' />
                    </property_group>
            </instance>
            <stability value='Evolving' />
            <template>
                    <common_name>
                            <loctext xml:lang='C'>
                                    Connect Direct for UNIX
                            </loctext>
                    </common_name>
                    <documentation>
                            <doc_link name='sterlingcommerce.com'
                               uri='http://www.sterlingcommerce.com/
                                    customer/tech_support.html' />
                    </documentation>
            </template>
    </service>
    </service_bundle>
  7. Verify that the owner and permissions of the manifest of the connect-direct.xml file match those of the other xml files in the /var/svc/manifest/application/ directory.
  8. Verify that the Connect:Direct FTP+ service stopped.