#! /bin/sh # /etc/init.d/cvsd script for starting and stopping cvsd # Copyright (C) 2002, 2003, 2004, 2005, 2006 Arthur de Jong # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ### BEGIN INIT INFO # Provides: cvsd # Required-Start: $local_fs $syslog # Required-Stop: $local_fs $syslog # Should-Start: $remote_fs $network # Should-Stop: $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: S 0 1 6 # Short-Description: cvs pserver chroot wrapper # Description: cvsd is a wrapper program for cvs in pserver mode. # It will run 'cvs pserver' under a special uid/gid in # a chroot jail. ### END INIT INFO PATH=/bin:/usr/bin:/sbin:/usr/sbin CVSD_BIN=/usr/sbin/cvsd DESC="cvs pserver chroot wrapper" CVSD_CFG=/etc/cvsd/cvsd.conf [ -x "$CVSD_BIN" ] || exit 0 [ -f "$CVSD_CFG" ] || exit 0 . /lib/lsb/init-functions PIDFILE=`sed -n 's/^ *PidFile *\([^ ]*\) *$/\1/p' < $CVSD_CFG` [ -n "$PIDFILE" ] && PFO="--pidfile $PIDFILE" case "$1" in start) log_daemon_msg "Starting $DESC" "cvsd" start-stop-daemon --start \ $PFO \ --startas $CVSD_BIN \ -- -f $CVSD_CFG log_end_msg $? ;; stop) log_daemon_msg "Stopping $DESC" "cvsd" start-stop-daemon --stop \ $PFO \ --name cvsd log_end_msg $? [ -n "$PIDFILE" ] && rm -f $PIDFILE ;; restart|force-reload) log_daemon_msg "Restarting $DESC" "cvsd" start-stop-daemon --stop --quiet --retry 10 \ $PFO \ --name cvsd [ -n "$PIDFILE" ] && rm -f $PIDFILE start-stop-daemon --start \ $PFO \ --startas $CVSD_BIN \ -- -f $CVSD_CFG log_end_msg $? ;; status) if [ -n "$PIDFILE" ] then if [ -f "$PIDFILE" ] then if kill -s 0 `cat $PIDFILE` > /dev/null 2>&1 then log_success_msg "cvsd running" exit 0 else log_success_msg "cvsd stopped" exit 1 fi else log_success_msg "cvsd stopped" exit 3 fi else if ps -ef | grep cvsd | grep -v grep > /dev/null 2>&1 then log_warning_msg "cvsd probably running (no PidFile in cvsd.conf)" else log_warning_msg "cvsd probably not running (no PidFile in cvsd.conf)" exit 3 fi fi ;; *) log_success_msg "Usage: $0 {start|stop|restart|force-reload|status}" exit 1 ;; esac exit 0