#!/bin/csh
##
# Copyright (C) 1996-1999  IDS Software.  All Rights Reserved.
#
# This software is the confidential and proprietary information of
# IDS Software ("Confidential Information").  You shall not
# disclose such Confidential Information and shall use it only in
# accordance with the terms of the license agreement you entered into
# with IDS Software.
#
# IDS SOFTWARE MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY
# OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
# THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
# PURPOSE, OR NON-INFRINGEMENT. IDS SOFTWARE SHALL NOT BE LIABLE FOR ANY
# DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
# DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
##

set self=$0
if ($self:h == $self) then
  setenv IDSS_HOME $PWD
else if ($self !~ /*) then
  setenv IDSS_HOME $PWD/$self:h
else
  setenv IDSS_HOME $self:h
endif

if (-e $IDSS_HOME/idss) then
  set pidfile=$IDSS_HOME/Logs/idss.pid
  if (-e $pidfile) then
    set pid=`cat $pidfile`
    /bin/sh -c "kill -0 $pid 2> /dev/null"
    if ($status == 0) then
      kill $pid
      if ($status == 0) then
        echo IDS Server \(PID $pid\) is stopped.
      else
        echo Failed to stop IDS Server \(PID $pid\).
      endif
      exit
    endif
    rm $pidfile
  endif
  echo IDS Server is not running.
else
  echo This shell script cannot be copied out of the IDS Server directory.
endif
