summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sci-biology/foldingathome/files/init-5.0.2-r1')
-rw-r--r--sci-biology/foldingathome/files/init-5.0.2-r145
1 files changed, 45 insertions, 0 deletions
diff --git a/sci-biology/foldingathome/files/init-5.0.2-r1 b/sci-biology/foldingathome/files/init-5.0.2-r1
new file mode 100644
index 000000000000..ef2f816bf691
--- /dev/null
+++ b/sci-biology/foldingathome/files/init-5.0.2-r1
@@ -0,0 +1,45 @@
+#!/sbin/runscript
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sci-biology/foldingathome/files/init-5.0.2-r1,v 1.1 2005/02/03 17:14:46 lostlogic Exp $
+
+do_config() {
+ if [ -z "${CPU}" ] || [ "${CPU}" == "0" ]; then
+ if [ -r /proc/cpuinfo ]; then
+ CPU=`grep processor </proc/cpuinfo | wc -l`
+ else
+ CPU=1
+ fi
+ fi
+}
+
+start() {
+ do_config
+ su foldingathome -c /opt/foldingathome/copy_client_config
+ for (($CPU; CPU > 0; CPU--)); do
+ ebegin "Starting Folding@Home on CPU ${CPU}"
+ cd /opt/foldingathome/client${CPU}/
+ nice -n 20 su foldingathome -c "/opt/foldingathome/client${CPU}/foldingathome ${FOLD_OPTS}" &>/dev/null &
+ eend $?
+ done
+}
+
+stop() {
+ do_config
+ for (($CPU; CPU > 0; CPU--)); do
+ ebegin "Stopping Folding@Home on CPU ${CPU}"
+ cd /opt/foldingathome/client${CPU}/
+ for I in FahCore*.exe; do
+ if ps ax|grep $I > /dev/null 2>&1; then
+ killall -q $I > /dev/null 2>&1
+ fi
+ done
+ sleep 1
+ if ps ax|grep '[/]opt[/]foldingathome/client${CPU}/' > /dev/null 2>&1; then
+ eend 1
+ else
+ eend 0
+ fi
+ done
+}
+