#!/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 96 01 # description: The Coda File Server # Source function library if we are a System V type OS using SYSV init. # Otherwise, we are probably a BSD like OS. VICE=/vice VICESRV=${VICE}/srv PIDDIR=${VICE}/srv PATH=/sbin:/usr/sbin:/usr/local/sbin:$PATH export PATH [ -f /usr/sbin/volutil ] || [ -f /usr/local/sbin/volutil ] || exit 0 [ -f /usr/sbin/codasrv ] || [ -f /usr/local/sbin/codasrv ] || exit 0 [ -f /usr/sbin/startserver ] || [ -f /usr/local/sbin/startserver ] || exit 0 [ -d $VICESRV ] || exit 0 if [ `uname` = 'SunOS' ] ; then LOCKFILE=$PIDDIR/codasrv.init.lock elif [ -d /var/lock/subsys ] ; then # RedHat LOCKFILE=/var/lock/subsys/codasrv.init else # Debian? LOCKFILE=/var/run/codasrv.lock fi echon() { if [ "`echo -n`" ] ; then echo "$@"\c else echo -n "$@" fi } # See how we were called. case "$1" in start) echon "Starting codasrv: " # file server rm -f $PIDDIR/pid if [ -f $LOCKFILE ]; then echo "codasrv already locked." exit 0 fi if [ ! -f ${VICESRV}/CRASH ]; then touch $LOCKFILE startserver & echo "codasrv." else echo "`date`: found CRASH, srv not started." >> ${VICE}/srv/SrvErr echo "found CRASH file, srv not started." fi ;; stop) # Normal Coda FS shutdown: # if pid file doesn't exist, it isn't likely that srv is running. echon "Shutting down codasrv: " if [ -f $PIDDIR/pid ]; then volutil shutdown echon "sleeping 30 secs to let srv shutdown..." sleep 30 fi rm -f $LOCKFILE echo "done." ;; hardstop) # Normal Coda FS shutdown: # if pid file doesn't exist, it isn't likely that srv is running. echon "Killing codasrv: " echon "codasrv " if [ `uname` = 'SunOS' ] ; then pkill -9 codasrv else killall -9 codasrv fi rm -f $LOCKFILE echo "done." ;; *) echo "Usage: $0 {start|stop|hardstop}" exit 1 esac exit 0