summaryrefslogtreecommitdiff
blob: c5bb460d482a965d444951a80f651bd9c5f54adb (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
#!/sbin/openrc-run
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $

extra_commands="unitinfo"

unitinfo() {
	einfo "$(head -n1 /opt/foldingathome/unitinfo.txt):"
	sed -e '1,2d' /opt/foldingathome/unitinfo.txt
}

start() {
	ebegin "Starting Folding@Home"
	cd /opt/foldingathome
	start-stop-daemon --chdir ${PWD} --user foldingathome --nicelevel 19 \
		--make-pidfile --pidfile "${PIDFILE}" \
		--start --background --exec ./FAHClient -- ${FOLD_OPTS}
	eend $?
}

stop() {
	ebegin "Stopping Folding@Home"
	start-stop-daemon --stop --user foldingathome --pidfile "${PIDFILE}"
	if [ $? -ne 0 ]; then
		killall --user foldingathome --signal SIGKILL
		ewarn "killing all processes running as user 'foldingathome' ..."
	fi
	eend $?
}