#! /bin/sh
###############################################################################
# Copyright 1997-2000 by mental images GmbH & Co.KG, Fasanenstr. 81, D-10623
# Berlin, Germany. All rights reserved.
#
# start and stop SPM daemon
#
# $Id: rcspm,v 1.3 2000/03/23 15:34:38 runa Exp $
#
SPMDIR=/var/spm
SPMD=spmd

killproc() {            # kill the named process(es)
        pid=`/usr/bin/ps -e |
             /usr/bin/grep $1 |
             /usr/bin/sed -e 's/^  *//' -e 's/ .*//'`
        [ "$pid" != "" ] && kill $signal $pid
}

case "$1" in
  'start')
	if test -x ${SPMDIR}/${SPMD}; then
		${SPMDIR}/${SPMD}
		echo "... ${SPMD} started ..."
	fi
	;;

  'stop')
	killproc ${SPMD}
	;;

  'restart')
	signal='-HUP'
 	killproc ${SPMD}
	echo "... ${SPMD} restarted ..."
	;;

  *)
	echo "usage: $0 {start|stop}"
	;;
esac
