From 251aa67903af196b8cfe6eac0ff04a37a456238d Mon Sep 17 00:00:00 2001 From: James Meyer Date: Tue, 4 Dec 2012 15:43:03 -0600 Subject: runit-scripts: move folding_at_home scripts to runitscripts Configuration of FAH was moved to the run script so it no longer needs or uses config.xml However if /etc/fah-config.xml is present it will use it and skip using values from /etc/systemconfig refs #872 --- abs/core/runit-scripts/PKGBUILD | 2 +- .../runit-scripts/runitscripts/services/fah/finish | 16 +++++++++++++ .../runit-scripts/runitscripts/services/fah/run | 27 ++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100755 abs/core/runit-scripts/runitscripts/services/fah/finish create mode 100644 abs/core/runit-scripts/runitscripts/services/fah/run diff --git a/abs/core/runit-scripts/PKGBUILD b/abs/core/runit-scripts/PKGBUILD index 47ffd97..970f927 100755 --- a/abs/core/runit-scripts/PKGBUILD +++ b/abs/core/runit-scripts/PKGBUILD @@ -1,6 +1,6 @@ pkgname=runit-scripts pkgver=2.1.1 -pkgrel=89 +pkgrel=90 pkgdesc="collection of startup scripts for runit" url="http://smarden.org/runit/" license="BSD" diff --git a/abs/core/runit-scripts/runitscripts/services/fah/finish b/abs/core/runit-scripts/runitscripts/services/fah/finish new file mode 100755 index 0000000..9385e7c --- /dev/null +++ b/abs/core/runit-scripts/runitscripts/services/fah/finish @@ -0,0 +1,16 @@ +#!/bin/bash +export TERM=linux +. /etc/rc.conf +. /etc/rc.d/functions + + +[ -e /etc/sv/fah/.runtime ] || mkdir -p /etc/sv/fah/.runtime +touch /etc/sv/fah/.runtime/`date +%s` +numfiles=`/usr/bin/file_time_offset.py -s4 -d/etc/sv/fah/.runtime ` +if [ $numfiles -gt 3 ] +then + rm -f /etc/sv/fah/.runtime/* 2>/dev/null + sv stop fah + printhl " folding@home is not able to start, disabling it" +fi + diff --git a/abs/core/runit-scripts/runitscripts/services/fah/run b/abs/core/runit-scripts/runitscripts/services/fah/run new file mode 100644 index 0000000..1a3b8a6 --- /dev/null +++ b/abs/core/runit-scripts/runitscripts/services/fah/run @@ -0,0 +1,27 @@ +#!/bin/sh +export TERM=linux +. /etc/rc.conf +. /etc/rc.d/functions +configfile=/etc/fah-config.xml +. /etc/systemconfig +FOLDING_DIR=/data/storage/disk0/media/foldingathome/$hostname +mkdir -p $FOLDING_DIR +chown mythtv:mythtv $FOLDING_DIR + +if [ -d $FOLDING_DIR ] +then + cd $FOLDING_DIR + if [ -e $configfile ] + then + stat_runit "Starting folding@home with $configfile" + exec /opt/fah-v7/FAHClient --config $configfile 2>&1 > /dev/null + else + stat_runit "Starting folding@home" + + /opt/fah-v7/FAHClient --run-as mythtv\ + --team=50975\ + --user=${foldingusername}\ + --max-packet-size=${foldingworksize} 2>&1 > /dev/null + + fi +fi \ No newline at end of file -- cgit v0.12