updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / boinc-svn / boinc.rc
blobf6470c528b0052e216e869118a959d55dcb6923e
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
7 BOINCUSER="boinc"
8 BOINCDIR="/var/lib/boinc"
9 PID=`pidof -o %PPID /usr/bin/boinc_client`
10 case "$1" in
11 attach)
12 echo "Enter the Project URL: "
13 read url
14 echo "Enter your Account Key: "
15 read key
16 echo "Attaching to project"
17 cd $BOINCDIR
18 su $BOINCUSER -c "boinccmd --project_attach $url $key"
20 start)
21 stat_busy "Starting boinc"
22 if [ -z "$PID" ]; then
23 su $BOINCUSER -c "nice -n 19 /usr/bin/boinc_client --daemon --dir ${BOINCDIR} --redirectio"
24 else
25 false
27 if [ $? -gt 0 ]; then
28 stat_fail
29 else
30 add_daemon boinc
31 stat_done
34 stop)
35 stat_busy "Stopping boinc"
36 [ ! -z "$PID" ] && kill $PID &> /dev/null
37 if [ $? -gt 0 ]; then
38 stat_fail
39 else
40 rm_daemon boinc
41 stat_done
44 restart)
45 $0 stop
46 sleep 2
47 $0 start
50 echo "usage: $0 {attach|start|stop|restart}"
51 esac
52 exit 0