NAME
bk initscripts − sample script for starting the
BitKeeper daemon
EXAMPLES
#!/bin/sh
#
|
# bitkeeper |
Start/stop the bitkeeper daemon. |
||||
|
# |
@(#)bitkeeper.init 1.1 Copyright (c) 2000 Larry McVoy |
#
# When starting repositories that are bound
# to a specific port, create a file named
# /var/bitkeeper/repositories. The repositories
# file will contain a line for each repository.
# The line consists of the directory where the
# repository resides and a set of options used
# when started the bk daemon.
#
# For example:
#
# ---- cut here and remove the leading hash mark and spaces
-----
# /home/bk/LMbench -p5000 -xcd -xpush -u99
# /home/bk/bitcluster -p6000 -xcd -xpush -u99
# /home/bk/one -p7000 -xcd -xpush -u99
# --------------------- cut here ----------------------
# Source
networking configuration.
if [ -f /etc/sysconfig/network ]
|
then |
. /etc/sysconfig/network |
||
|
# Check that networking is up. |
|||
|
[ ${NETWORKING} = "no" ] && exit 0 |
fi
[ -x /usr/bin/bk ] || exit 0
VAR=/var/bitkeeper
case "$1" in
|
echo "Start BitKeeper daemons" |
|||||
|
;; |
echo "Stop BitKeeper daemons" |
||||
|
;; |
$0 stop |
||||
|
$0 start |
|||||
|
;; |
cd $VAR || exit 1 |
||||
|
test -f repositories || { |
|||||
|
echo Nothing advertised: Are there any entries in the |
|||||
|
echo $VAR/repositories file? |
|||||
|
exit 0 |
|||||
|
} |
|||||
|
while read dir opts |
|||||
|
do |
( |
||||
|
cd $dir || exit 1 |
|||||
|
F=`basename $dir` |
|||||
|
bk bkd $opts -l$VAR/log.$F -P$VAR/pid.$F |
|||||
|
echo Started bkd $opts in $dir |
|||||
|
) |
|||||
|
done < repositories |
|||||
|
;; |
stop)
|
cd $VAR || exit 1 |
|||||
|
echo Shutting down BitKeeper daemons |
|||||
|
for i in pid.* |
|||||
|
do |
kill -TERM `cat $i` |
||||
|
rm $i |
|||||
|
done |
|||||
|
;; status) |
ps -axf | grep bkd |
||||
|
;; *) |
|||||
|
echo "Usage: bitkeeper {start|stop|restart|status}" |
|||||
|
exit 1 |
|||||
|
;; |
esac
exit 0
CATEGORY
Overview
Admin