@ECHO OFF

REM

REM CommuniGate Pro startup script

REM Copyright (c) 2002-2005, Stalker Software, Inc.

REM

REM

SET BASEDIRECTORY=C:\CommuniGate

SET APPLICATION=C:\STALKER\CommuniGate

SET SUPPLPARAMS=



REM Custom startup parameters

IF EXIST %BASEDIRECTORY%\Startup.CMD CALL %BASEDIRECTORY%\Startup.CMD



IF NOT EXIST %APPLICATION%\CGServer.exe EXIT 



IF NOT %1.==start. GOTO CONTROLLER

   ECHO Starting CommuniGate Pro

   DETACH %APPLICATION%\CGServer.exe --Base %BASEDIRECTORY% %SUPPLPARAMS% <NUL >NUL 2>NUL

   exit 0



:CONTROLLER

IF NOT %1.==controller. GOTO STOP

   ECHO Starting CommuniGate Pro Cluster Controller

   DETACH %APPLICATION%\CGServer.exe --Base %BASEDIRECTORY% %SUPPLPARAMS% --ClusterController <NUL >NUL 2>NUL

   exit 0



:STOP

IF NOT %1.==stop. GOTO USAGE

  IF EXIST %BASEDIRECTORY%\ProcessID GOTO KILL

    ECHO looks like the CommuniGate Pro Server is not running

    exit 0

:KILL

   ECHO killing CommuniGate Pro

   %APPLICATION%\kill.exe -f %BASEDIRECTORY%\ProcessID 

   exit 0



:USAGE

  ECHO "usage: %0% [start | stop | controller]"

  exit 1

