summaryrefslogtreecommitdiffstats
path: root/net/boinc-client/files/boinc.sh
blob: 77fc535ab612c60aa72576e8e4e830ed16237439 (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
#!/bin/sh
#
# $FreeBSD: /tmp/pcvs/ports/net/boinc-client/files/Attic/boinc.sh,v 1.1 2004-10-16 19:29:30 pav Exp $
#
# Start or stop BOINC
#

. /etc/rc.subr

name="boinc"
rcvar=`set_rcvar`

boinc_user=%%BOINC_USER%%
boinc_home=%%BOINC_HOME%%
program_file=%%BOINC_BINARY%%
program_path=%%BOINC_DATADIR%%/client/${program_file}

[ -z "$boinc_enable" ] && boinc_enable="NO"

load_rc_config $name

case "$1" in
start)
	if checkyesno boinc_enable
	then
		if [ ! -x ${program_path} ]
		then
			logger -sp ${syslog_facility} -t ${program_file} \
				"unable to start: ${program_path} is missing."
			exit 72
		fi
		if ps axo ucomm | egrep ${program_file}; then
			logger -sp ${syslog_facility} -t ${program_file} \
			"unable to start: ${program_file} is already running."
			exit 72
		fi
		echo -n "BOINC "
		idprio 31 su - ${boinc_user} -c "${program_path} >/dev/null &"
	fi
	;;

stop)
	program=`expr ${program_file} : '^\(...................\).*$'`
	killall ${program} 2> /dev/null
	;;

restart)
	$0 stop
	$0 start
	;;

status)
	ps auxww | egrep ${program_file} | egrep -v "($0|egrep)"
	;;

*)
	echo "usage: ${name} {start|stop|restart|status}" >&2
	exit 64
	;;
esac

OpenPOWER on IntegriCloud