blob: f3a51207491209e99f4c4a4a7a5a30300c4bb1b8 (
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
#!/sbin/openrc-run
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
opts="${opts} reload fetch flush"
depend() {
use net
}
processOpts() {
local retVal=1
DNETPATH="/opt/distributed.net"
DNETBIN="${DNETPATH}/dnetc"
STARTOPTS="--start --chuid dnetc:dnetc --quiet \
--exec ${DNETBIN}"
DNETOPTS="-quiet"
if [ -e /etc/dnetc.ini ] ; then
retVal=0
DNETOPTS="${DNETOPTS} -ini /etc/dnetc.ini"
elif [ -e ${DNETPATH}/dnetc.ini ]; then
retVal=0
DNETOPTS="${DNETOPTS} -ini ${DNETPATH}/dnetc.ini"
elif [ ! -z ${EMAIL} ]; then
retVal=0
fi
# override ini settings with values in /etc/conf.d/dnetc
DNETOPTS="${DNETOPTS} ${EMAIL:+-e ${EMAIL}}"
if [ ! -z ${BUFFER_BASE_DIR} ] ; then
local buff_in="${BUFFER_BASE_DIR:+${BUFFER_BASE_DIR}/}buff-in"
local buff_out="${BUFFER_BASE_DIR:+${BUFFER_BASE_DIR}/}buff-out"
DNETOPTS="${DNETOPTS} -inbase ${buff_in}"
DNETOPTS="${DNETOPTS} -outbase ${buff_out}"
fi
DNETOPTS="${DNETOPTS} ${KEYSERVER_ADDRESS:+-a ${KEYSERVER_ADDRESS}}"
# fair group cpu scheduler
uidpath="/sys/kernel/uids/`id -u dnetc`"
[ -d $uidpath ] && echo 2 >$uidpath/cpu_share
unset uidpath
if [ ${retVal} -ne 0 ] ; then
eerror "Need some sort of configuration. Check /etc/conf.d/dnetc."
fi
return ${retVal}
}
start() {
processOpts || return 1
ebegin "Starting distributed.net client"
start-stop-daemon ${STARTOPTS} -- ${DNETOPTS}
eend ${?}
}
stop() {
processOpts || return 1
ebegin "Stopping distributed.net client"
start-stop-daemon --stop --quiet --exec ${DNETBIN} --
eend ${?}
}
reload() {
processOpts || return 1
ebegin "Reloading distributed.net client"
start-stop-daemon --stop --quiet --signal HUP --exec ${DNETBIN}
eend ${?}
}
fetch() {
processOpts || return 1
ebegin "Fetching distributed.net client buffers"
${DNETBIN} ${DNETOPTS} -fetch
eend ${?}
}
flush() {
processOpts || return 1
ebegin "Flushing distributed.net client buffers"
${DNETBIN} ${DNETOPTS} -flush
eend ${?}
}
|