#!/sbin/sh # Start/Stop Subversion server # ACCOUNT, under which the milter should run ACCOUNT=svn . /lib/svc/share/smf_include.sh BASEDIR=@CLIENT_BASEDIR@ ROOTDIR=`/usr/bin/svcprop -p config/root $SMF_FMRI 2>/dev/null` if [ -z "$ROOTDIR" -o '""' = "$ROOTDIR" ]; then ROOTDIR="" else ROOTDIR="--root=$ROOTDIR" fi THREADS=`/usr/bin/svcprop -p config/threads $SMF_FMRI 2>/dev/null` if [ "$THREADS" = "true" ]; then THREADS="--threads" else THREADS="" fi PORT=`/usr/bin/svcprop -p config/port $SMF_FMRI 2>/dev/null` if [ -z "$PORT" -o "$PORT" = '""' ]; then PORT='--listen-port=3690' else PORT="--listen-port=$PORT" fi HOST=`/usr/bin/svcprop -p config/host $SMF_FMRI 2>/dev/null` if [ -z "$HOST" -o "$HOST" = '""' ]; then HOST="" else HOST="--listen-host=$HOST" fi READONLY=`/usr/bin/svcprop -p config/readonly $SMF_FMRI 2>/dev/null` if [ "$READONLY" = "true" ]; then READONLY="--read-only" else READONLY="" fi ZN=`/sbin/zonename` if [ "$ZN" = "global" ]; then ZPPID=1 else ZPPID=`pgrep -x zsched 2>/dev/null` fi case "$1" in 'start') echo "Starting subversion server ..." if [ ! -x $BASEDIR/sbin/svnserve ]; then echo "failed (unable to execute $BASEDIR/sbin/svnserve)" exit $SMF_EXIT_ERR_FATAL fi PID=`pgrep -x -u $ACCOUNT -P $ZPPID svnserve 2>/dev/null` if [ -n "$PID" ]; then echo "is already running." exit $SMF_EXIT_OK fi $BASEDIR/sbin/svnserve --daemon $ROOTDIR $THREADS $PORT $HOST $READONLY if [ $? -ne 0 ]; then echo "failed." exit $SMF_EXIT_ERR_FATAL fi echo "done." ;; 'stop') echo "Stopping subversion server ..." pkill -9 -x -u $ACCOUNT -P $ZPPID svnserve echo "done." ;; *) echo "Usage: $0 { start | stop }" exit 1 ;; esac exit $SMF_EXIT_OK