diff options
Diffstat (limited to 'community/boinc/boinc.rc')
-rw-r--r-- | community/boinc/boinc.rc | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/community/boinc/boinc.rc b/community/boinc/boinc.rc new file mode 100644 index 000000000..160043a04 --- /dev/null +++ b/community/boinc/boinc.rc @@ -0,0 +1,52 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + + +BOINCUSER="boinc" +BOINCDIR="/var/lib/boinc" +PID=`pidof -o %PPID /usr/bin/boinc_client` +case "$1" in + attach) + echo "Enter the Project URL: " + read url + echo "Enter your Account Key: " + read key + echo "Attaching to project" + cd $BOINCDIR + su $BOINCUSER -c "boinccmd --project_attach $url $key" +;; + start) + stat_busy "Starting boinc" + if [ -z "$PID" ]; then + su $BOINCUSER -c "nice -n 19 /usr/bin/boinc_client --daemon --dir ${BOINCDIR} --redirectio" + else + false + fi + if [ $? -gt 0 ]; then + stat_fail + else + add_daemon boinc + stat_done + fi + ;; + stop) + stat_busy "Stopping boinc" + [ ! -z "$PID" ] && kill $PID &> /dev/null + if [ $? -gt 0 ]; then + stat_fail + else + rm_daemon boinc + stat_done + fi + ;; + restart) + $0 stop + sleep 2 + $0 start + ;; + *) + echo "usage: $0 {attach|start|stop|restart}" +esac +exit 0 |