/*
        Ŀ
        Ĵ
        Ĵ   PROJECT      : Spawner (Lan Server Process Spawner)   Ĵ
        Ĵ   FILE         : Spawner.C -  Main Module               Ĵ
        Ĵ   Last modified: 11 Sep 04                              Ĵ
        Ĵ
        

	Spawner - Lan Server Process Spawner

	Copyright (C) 2004 Chris Graham - WarpSpeed Computers

	chrisg@warpspeed.com.au
*/

Synopsis
--------

    Spawner.exe is an IBM Lan Server or MS Lan Manager service that
    spawns other programs.

    This allows these other programs to be controlled as if they
    were services themselves.

    For example. The FTP Daemon (ftpd.exe) is a normal command line
    OS/2 executable. It can not normally be started as a service.

    Using the Spawner service, you can now start ftpd.exe as if it
    were a service using a command similar to:

        NET START FTP

    As far as I am aware, the only restriction is that the spawned
    program needs to be able to run as a detached process (not all can).

    This also allows management of remote hosts using NETGUI.

Requirements
------------

    OS/2 1.2 or above.
    IBM Lan Server (including Peer) or Microsoft Lan Manager

Installation
------------

    Simply copy the program Spawner.Exe to the services directory.

    Eg:

    C:\IBMLAN\SERVICES

Configuration
-------------

    This is a two step process.

    You will need to edit IBMLAN.INI (or LANMGR.INI).

    Step 1. Add the service name to the [services] section and
            set the program name to Spawner.exe. The service name
            can not have any spaces in it.

    Step 2. Add the service name section to the file and specify
            the parameters needed as appropriate.

	You can have these services started automatically.

    If you want these services to be automatically started when
	you start your requester (NET START REQ), you may add
	them to the WRKSERVICES line in the [requester] section.

	If you want these services to be automatically started when
	you start your server (NET START SERVER), you may add
	them to the SRVSERVICES line in the [server] section.


Parameters
----------

	Each service name can have five parameters specified.
	Only the programPath parameter is mandatory.

	The parameter names are case insensitive.

    programPath     MANDATORY
    -----------

    Specifies the fully qualified path of the program to run.

    programArgs     OPTIONAL
    -----------

    Specifies any parameters to be passed to the program.

    startupDir      OPTIONAL
    ----------

    Specfies the initial starting directory from which the
    program is run.

    raiseAlert      OPTIONAL
    ----------

    TRUE or FALSE, with FALSE being the default value.
    If true, an adminiserative alert will be sent if the
    program unexpectedly exits (or is killed externally).

    For this to function correctly the MESSENGER and ALERTER
    services need to have been started.
    Also, the alerts are sent to all user id's listed in the
    ALERTNAMES entry in the [SERVER] section of IBMLAN.INI.

    programReStart  OPTIONAL
    --------------

    TRUE or FALSE, with FALSE being the default value.
    If true, the program will be restarted if it unexpectedly
    exits (or is killed externally).

Errors
------

	All errors are sent to the error log. These can be viewed
	with the NET ERROR or LSERROR commands.

Example
------

[services]

; Correlates name of service to pathname of service program.
; The pathname must be either
;       1) an absolute path (including the drive specification)
;                       OR
;       2) a path relative to the IBMLAN root
  alerter = services\alerter.exe
  dcdbrepl = services\dcdbrepl.exe
  lsserver = services\lsserver.exe
  messenger = services\msrvinit.exe
  netlogon = services\netlogon.exe
  netrun = services\runservr.exe
  replicator = services\replicat.exe
  requester = services\wksta.exe
  server = services\netsvini.exe
  timesource = services\timesrc.exe
  browser = services\browser.exe
  ftp = services\spawner.exe
  time = services\spawner.exe
  SetiAtHome1 = services\spawner.exe
  SetiAtHome2 = services\spawner.exe
  httpd = services\spawner.exe
  mysql = services\spawner.exe

[ftp]
  programPath    = C:\Tcpip\Bin\ftpd.exe
  programArgs    =
  raiseAlert     = true
  programReStart = false

[time]
  programPath    = C:\Tcpip\Bin\timed.exe
  programArgs    =
  raiseAlert     = true
  programReStart = true

[SetiAtHome1]
  programPath    = C:\OS2Stuff\SetiAtHome.Exe
  programArgs    =
  startupDir     = G:\Seti-1
  raiseAlert     = true
  programReStart = true

[SetiAtHome2]
  programPath    = C:\OS2Stuff\SetiAtHome.Exe
  programArgs    =
  startupDir     = G:\Seti-2
  raiseAlert     = true
  programReStart = true

[httpd]
  programPath    = E:\Apache\httpd.exe
  programArgs    =
  startupDir     = E:\Apache
  raiseAlert     = true
  programReStart = true

[mysql]
  programPath	 = E:\MYSQL\BIN\MYSQLD.EXE
  programArgs    =
  startupDir	 =
  raiseAlert     = true
  programReStart = true


Revision History
----------------

11/09/04	Initial Release
--------

    Initial Version.
