blob: c54e0313dc2ae7af4e2df0fd45bd0cc9758b38b7 (
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
|
#!/sbin/runscript
opts="${opts} attach"
depend() {
use dns
need net
}
start() {
ebegin "Starting BOINC"
if [ ! -d ${RUNTIMEDIR} ]; then
einfo "Directory ${RUNTIMEDIR} not existing, creating now."
/bin/mkdir ${RUNTIMEDIR}
/bin/chown ${USER}:${GROUP} ${RUNTIMEDIR}
if [ ! -d ${RUNTIMEDIR} ]; then
eerror "Directory ${RUNTIMEDIR} could not be created!"
return 1
fi
fi
cd ${RUNTIMEDIR}
if [ ! -f lockfile ]; then
einfo "File ${RUNTIMEDIR}/lockfile does not exist, assuming first run."
einfo "You need to setup an account on the BOINC project homepage beforehand! Go to http://boinc.berkeley.edu/ and locate your project."
einfo "Then either run /etc/init.d/boinc attach or connect with a gui client and attach to a project with that."
fi
# if the log file doesn't exist, create it with root privs, then change ownership to boinc
if [ ! -f ${LOGFILE} ]; then
touch ${LOGFILE}
chown ${USER}:${GROUP} ${LOGFILE}
fi
if [ ${ALLOW_REMOTE_RPC} = "yes" ]; then
ARGS="${ARGS} -allow_remote_gui_rpc"
fi
setsid start-stop-daemon --quiet --start --exec ${BOINCBIN} \
--chuid ${USER}:${GROUP} --nicelevel ${NICELEVEL} -- ${ARGS} > ${LOGFILE} 2>&1 &
eend $?
}
attach() {
printf " Enter the Project URL: "
read url
printf " Enter your Account Key: "
read key
RC_QUIET_STDOUT="yes" svc_status
if [ $? == 0 ]; then
ebegin "Attaching to project"
# boinc cmd does not return 1 when it fails currently
boinc_cmd --project_attach ${url} ${key} &> /dev/null
eend $?
else
ARGS="${ARGS} -attach_project ${url} ${key}" svc_start
fi
sleep 9
tail ${LOGFILE}
}
stop() {
ebegin "Stopping BOINC"
start-stop-daemon --stop --quiet --exec ${BOINCBIN}
eend $?
}
restart() {
svc_stop
sleep 6
svc_start
}
|