aboutsummaryrefslogtreecommitdiff
path: root/src/boinc/boinc.rc
diff options
context:
space:
mode:
Diffstat (limited to 'src/boinc/boinc.rc')
-rwxr-xr-xsrc/boinc/boinc.rc52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/boinc/boinc.rc b/src/boinc/boinc.rc
new file mode 100755
index 0000000..160043a
--- /dev/null
+++ b/src/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