Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 0fc7b6c0681fcc2d1f1baac979191cc8 > files > 2

coda-debug-server-5.3.17-2mdk.i586.rpm

#!/bin/sh
#
# skeleton      Example file to build /etc/init.d scripts.
#
# Version:      @(#) /etc/init.d/skeleton 1.01 26-Oct-1993
#
# Author:       Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
#

# chkconfig: 345 95 01
# description: The Coda authentication server.

# Source function library if we are a System V type OS using SYSV init.
# Otherwise, we are probably a BSD like OS.

PIDDIR=/vice/auth2
DBDIR=/vice/db

PATH=/sbin:/usr/sbin:/usr/local/sbin:$PATH
export PATH

[ -d $PIDDIR ] || exit 0

for dir in /usr/sbin /usr/local/sbin ; do
    for auth in kauth2 auth2 ; do
	if [ -f $dir/$auth ] ; then
	    AUTH2=$dir/$auth
	    break 2
	fi
    done
done
if [ -z "$AUTH2" ] ; then
    exit 0
fi

if [ "`cat /vice/hostname`" != "`cat /vice/db/scm`" ]; then
    FLAGS="$FLAGS -chk "
fi


if [ `uname` = 'SunOS' ] ; then
    LOCKFILE=$PIDDIR/auth2.init.lock
elif [ -d /var/lock/subsys ] ; then # RedHat
    LOCKFILE=/var/lock/subsys/auth2.init
else
    # Debian?
    LOCKFILE=/var/run/auth2.lock
fi

echon() {
    if [ "`echo -n`" ] ; then
        echo "$@"\c
    else
        echo -n "$@"
    fi
}

# See how we were called.
case "$1" in
  start)
        echon "Starting auth2: "
	if [ ! -f $LOCKFILE ]; then
		touch $LOCKFILE
		${AUTH2} ${FLAGS} &
		echon "${AUTH2} ${FLAGS}"
	else
		echo "auth2: already locked."
		exit 1
	fi
	echo "done."
	;;
  stop)
        echon "Stopping auth2: "
	if [ -f $PIDDIR/pid ]; then
		kill -9 `cat $PIDDIR/pid`
	fi
	rm -f $LOCKFILE
	echo "done."
	;;

 restart)
        $0 stop
        $0 start
        ;;

  *)
	echo "Usage: $0 {start|stop|restart}"
	exit 1
esac

exit 0