#!/sbin/runscript # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/dev-util/cvsd/files/cvsd.rc6,v 1.3 2004/07/14 22:09:01 agriffis Exp $ checkconfig() { # binary location CVSD_BIN=/usr/sbin/cvsd if [ ! -x "$CVSD_BIN" ]; then eerror "cvsd cannot be found" return 1 fi # default path CVSD_CFG=/etc/cvsd/cvsd.conf if [ ! -f "$CVSD_CFG" ]; then eerror "No cvsd config file found" return 1 fi PIDFILE=`sed -n 's/^ *PidFile *\([^ ]*\) *$/\1/p' < $CVSD_CFG` if [ -n "$PIDFILE" ]; then PFO="--pidfile $PIDFILE" fi } depend() { need net } start() { checkconfig || return 1 ebegin "Starting cvsd" start-stop-daemon --start --quiet \ $PFO \ --startas $CVSD_BIN \ -- -f $CVSD_CFG \ || ebegin " already running" eend $? } stop() { checkconfig || return 1 ebegin "Stopping cvsd" start-stop-daemon --stop --quiet \ $PFO \ --name cvsd \ || ebegin " not running" [ -n "$PIDFILE" ] && rm -f $PIDFILE eend $? } restart() { checkconfig || return 1 svc_stop svc_start } status() { checkconfig || return 1 ebegin "Status of cvsd: " if [ -n "$PIDFILE" ] then if [ -f "$PIDFILE" ] then if kill -s 0 `cat $PIDFILE` > /dev/null 2>&1 then ebegin "running." return 0 else ebegin "stopped." return 0 fi else ebegin "stopped." return 0 fi else if ps -ef | grep cvsd | grep -v grep > /dev/null 2>&1 then ebegin "probably running. (no PidFile in cvsd.conf)" else ebegin "probably not running. (no PidFile in cvsd.conf)" return 0 fi fi }