blob: b0cc6d42361ad90edbdc69965135b354cc02ebbb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#!/sbin/runscript
cpus=`egrep -c "^processor" /proc/cpuinfo`
checkconfig() {
if [ ! -e ${CHESSBRAIN_DIR} ]
then
einfo "Creating ${CHESSBRAIN_DIR}"
mkdir ${CHESSBRAIN_DIR}
fi
if [ $cpus != '1' ]; then
cd ${CHESSBRAIN_DIR}
for cpu in `seq 2 $cpus`; do
if [ ! -e ${CHESSBRAIN_DIR}/cpu${cpu} ]; then
mkdir ${CHESSBRAIN_DIR}/cpu${cpu}
cp ${CHESSBRAIN_DIR}/* ${CHESSBRAIN_DIR}/cpu${cpu} > /dev/null
cp ${CHESSBRAIN_DIR}/cbspan.conf ${CHESSBRAIN_DIR}/cpu${cpu}
fi
done
fi
}
start() {
checkconfig
if [ $cpus = '1' ]; then
ebegin "Starting ChessBrain"
else
ebegin "Starting ChessBrain ($cpus processors)"
fi
for cpu in `seq 1 $cpus`; do
cd ${CHESSBRAIN_DIR}
if [ $cpu != '1' ]; then
cd cpu${cpu}
fi
./cbspn >&/dev/null&
done
eend $?
}
stop() {
ebegin "Stopping ChessBrain"
killall cbspn
eend $?
}
|