1#!/bin/sh
2
3# chkconfig: 345 96 04
4# description: cvsd is a wrapper program for cvs in pserver mode. it \
5# will run 'cvs pserver' under a special uid/gid in a chroot jail.
6
7# /etc/init.d/cvsd script for starting cvsd
8# Copyright (C) 2002, 2003, 2004 Arthur de Jong
9#
10# This program is free software; you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation; either version 2 of the License, or
13# (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18# GNU General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License
21# along with this program; if not, write to the Free Software
22# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23
24. /etc/rc.d/init.d/functions
25
26CVSD_BIN=@CVSD_BIN@
27DESC="cvs pserver chroot wrapper"
28CVSD_CFG=@CONFIGFILE@
29
30[ -x "$CVSD_BIN" ] || exit 0
31[ -f "$CVSD_CFG" ] || exit 0
32
33PIDFILE=`sed -n 's/^ *PidFile *\([^ ]*\) *$/\1/p' < $CVSD_CFG`
34
35case "$1" in
36start)
37  echo -n "Starting $DESC: cvsd"
38  daemon $CVSD_BIN -f $CVSD_CFG
39  echo
40  ;;
41stop)
42  echo -n "Stopping $DESC: cvsd"
43  killproc $CVSD_BIN
44  echo
45  [ -n "$PIDFILE" ] && rm -f $PIDFILE
46  ;;
47restart)
48  $0 stop
49  sleep 2
50  $0 start
51  ;;
52status)
53  status $CVSD_BIN
54  ;;
55*)
56  echo "Usage: $0 {start|stop|restart|status}"
57  exit 1
58  ;;
59esac
60
61exit 0
62