#!/bin/sh
# chkconfig: 345 98 20
# description: Subversion server
# processname: svnserve
# description for chkconfig: 345 98 20
# 345: run levels
# 98: priority to start
# 20: priority to stop
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/svnserve
REPOSITORY=/var/svn/repos
NAME=svnserve
DESC="Subversion server"
USER=repos
PIDFILE=/var/run/$NAME.pid
test -x $DAEMON || exit 0
if [ -f /etc/default/$NAME ]; then
. /etc/default/$NAME
fi
DAEMON_OPTS="-d -r $REPOSITORY $OPTIONS"
start_proc() {
sudo -u $USER $DAEMON $DAEMON_OPTS
if [ "$?" -eq 0 ]
then
pidof $DAEMON > $PIDFILE
return 0
fi
return 1
}
stop_proc() {
kill -9 `cat $PIDFILE 2>/dev/null`
[ "$?" -ne 0 ] && return 1
rm -f $PIDFILE
return 0
}
status_proc() {
killall -0 $DAEMON 2>/dev/null
return "$?"
}
case "$1" in
start)
echo "Starting ${DESC}"
start_proc
[ "$?" -eq 0 ] || echo "failed"
;;
stop)
echo "Shutting down ${DESC}"
stop_proc
[ "$?" -eq 0 ] || echo "failed"
;;
restart|force-reload)
echo "Restarting ${DESC}"
stop_proc
if [ $? -ne 0 ]; then
failure ; echo ; exit 0
fi
sleep 1
start_proc
[ "$?" -eq 0 ] || echo "failed"
;;
status)
status_proc
[ $? -eq 0 ] && echo "$DESC is alive" || echo "$DESC is dead"
echo
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2
exit 1
;;
esac
exit 0
まとめページ
▼
2011/04/17
chkconfig対応のsvnserv init script
/etc/init.d/svnserv:
0 件のコメント:
コメントを投稿