#!/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 02 # description: The Coda update server and clients # Source function library if we are a System V type OS using SYSV init. # Otherwise, we are probably a BSD like OS. LOCKDIR=/var/lock/subsys PIDDIR=/vice/misc SCMFILE=/vice/db/scm PATH=/sbin:/usr/sbin:/usr/local/sbin:$PATH export PATH [ -f /usr/sbin/updatesrv ] || [ -f /usr/local/sbin/updatesrv ] || exit 0 [ -f /usr/sbin/updateclnt ] || [ -f /usr/local/sbin/updateclnt ] || exit 0 [ -d $PIDDIR ] || exit 0 if [ `uname` = 'SunOS' ] ; then LOCKFILE=$PIDDIR/update.init.lock else # redhat and debian? LOCKDIR=/var/lock/subsys [ -d $LOCKDIR ] || exit 0 LOCKFILE=$LOCKDIR/update.init fi echon() { if [ "`echo -n`" ] ; then echo "$@"\c else echo -n "$@" fi } # See how we were called. case "$1" in start) echon "Starting coda update servers: " # rpc2portmap if [ -f $LOCKFILE ]; then echo "already locked." exit 1 fi if [ "`cat /vice/hostname`" = "`cat /vice/db/scm`" ]; then echon "rpc2portmap " rpc2portmap & echon "updatesrv " updatesrv & fi echon "updateclnt " updateclnt -h `cat $SCMFILE` & echo "done." ;; stop) if [ "`cat /vice/hostname`" = "`cat /vice/db/scm`" ]; then echon "Stopping coda update servers " echon "rpc2portmap " if [ `uname` = 'SunOS' ] ; then pkill -9 rpc2portmap else killall -9 rpc2portmap fi if [ -f $PIDDIR/updatesrv.pid ]; then echon "updatesrv " kill -9 `cat $PIDDIR/updatesrv.pid` fi fi if [ -f $PIDDIR/updateclnt.pid ]; then echon "updateclnt " kill -9 `cat $PIDDIR/updateclnt.pid` fi rm -f $LOCKFILE echo "done." ;; restart) $0 stop $0 start ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 esac exit 0