New official Linux installation/configuration guides

Moderators: Site Moderators, PandeGroup

Re: New official Linux installation/configuration guides

Postby darrenleeweber » Tue Jun 07, 2011 10:53 pm

Here's a bash script to install "folding" at home as an upstart service on Ubuntu systems (see The last part requires sudo privilege.

When using Ubuntu, using shell scripts and instructions like these are already familiar, but for those unfamiliar with shell scripts, follow these steps to use this bash script:
a) Select and copy all the code text below
b) Open your favorite text editor and paste all the text into it
c) Save the new text file (as plain text) into a file called ""
d) Open a terminal (GNOME: Applications > Accessories > Terminal)
e) Let's assume the file was saved in your home directory, so in the terminal, type:
Code: Select all
cd ~
chmod +x ~/

Here's the entire content of the shell script to place in file "":
Code: Select all

# --- Only run on Ubuntu
uname -a | grep Ubuntu > /dev/null 2>&1
if [ $? -ne 0 ]; then
    # This is not an Ubuntu system
    exit 1

# --- Only run from the path where fah6 exists
if [ ! -x ./fah6 ]; then
    echo "We don't have a fah6 executable here, let's not continue"
    exit 1

# --- Set some arguments to fah6
FAH_ARGS="-verbosity 9"
# Do we have an SMP system?
uname -a | grep SMP > /dev/null 2>&1
if [ $? -eq 0 ]; then
    # This is an SMP system
    cores=$(cat /proc/cpuinfo | grep processor | wc -l)
    FAH_ARGS+=" -smp $cores "

# --- Create a 'folding.conf' init file for upstart

mkdir -p tmp
cat > tmp/folding.conf << INIT
# chkconfig: 345 93 14
# folding - Folding@home

description "Folding@home service,"

start on filesystem
stop on runlevel [!2345]

respawn limit 10 5
umask 022

pre-start script
    test -x ${PWD}/fah6 || { stop; exit 0; }
    test -c /dev/null || { stop; exit 0; }
    mkdir -p -m0755 /var/run/folding
end script

post-stop script
    # Archive or upload work data for later restart?
    #${PWD}/fah6 -send all
    rm -rf /var/run/folding
end script

exec ${PWD}/fah6 $FAH_ARGS
console none

# --- Install the startup file

echo "About to install upstart service to /etc/init/folding.conf"
echo "This requires sudo privileges"
sudo cp tmp/folding.conf /etc/init/
sudo chown root:root /etc/init/folding.conf
sudo chmod 644 /etc/init/folding.conf
rm tmp/folding*

# --- start/restart the service

sudo service folding restart

Once the service is installed, it can be controlled with any of these 'service' commands:
Code: Select all
service folding status
sudo service folding restart
sudo service folding start
sudo service folding stop

I hope this helps,
Darren Weber, Ph.D.
Posts: 2
Joined: Tue Jun 07, 2011 8:38 pm

Re: New official Linux installation/configuration guides

Postby filu » Wed Jun 29, 2011 1:34 pm

On my Ubuntu 11.04, this script does not work. The service starts, but the client does not fold.
In the code FAH_ARGS ="-verbosity 9 " I tried to add flag -bigadv.
i7-2600K@4.8 Asus P8P67 EVO 2x2GB GTX480
i7-920@4.0 GA-EX58-UD5 3x2GB 2xGTX560Ti
2x Xeon 5620 6x 2GB
2x Xeon 5645 6x 2GB
Posts: 76
Joined: Mon Aug 03, 2009 9:33 am
Location: Krzeszyce, Poland

Re: New official Linux installation/configuration guides

Postby the8lack8ox » Tue Aug 16, 2011 8:41 pm

Here's a nice little init script I wrote that starts up and shuts down Folding on command:
Code: Select all
# chkconfig: 345 93 14
# description: Start Folding@home distributed computing client

. /etc/init.d/functions

start() {
   echo -n Starting Folding@home:
   su - foldingathome -c "./fah6 -smp -verbosity 9 </dev/null >/dev/null 2>&1 &"
   touch /var/lock/subsys/foldingathome
   success $"Folding@home startup"

stop() {
   echo -n Stopping Folding@home:
   killproc fah6
   rm -f /var/lock/subsys/foldingathome

case "$1" in
      status fah6
      echo $"Usage: $0 {start|stop|restart|reload|status}"
      exit 1

exit 0

Save it to /etc/init.d/foldingathome and run the following as root:
Code: Select all
# useradd foldingathome
# su - foldingathome -c "wget && tar xf *.tgz && chmod +x fah6 && ./fah6 -configonly"
# chmod +x /etc/init.d/foldingathome
# chkconfig --add foldingathome

Control it with:
Code: Select all
# service foldingathome start
# service foldingathome stop

I've also written a systemd service file for Fedora 15 and later:
Code: Select all
Description=Folding@home distributed computing client

ExecStart=/home/foldingathome/fah6 -smp


Save it to /lib/systemd/system/foldingathome.service and execute as root:
Code: Select all
# useradd foldingathome
# su - foldingathome -c "wget && tar xf *.tgz && chmod +x fah6 && ./fah6 -configonly"
# systemctl enable foldingathome.service

Control it with:
Code: Select all
# systemctl start foldingathome.service
# systemctl stop foldingathome.serivce
Posts: 1
Joined: Tue Aug 16, 2011 8:21 pm

Re: New official Linux installation/configuration guides

Postby dee » Sat Sep 17, 2011 2:42 pm

Nice job, Darren. It works like a champ using Ubuntu 11.04. My only suggestion is that it would have been a nicety to have the results in a separate folder, instead of being spread across the end of the file system root folder. --Dee--
Posts: 1
Joined: Thu Jun 30, 2011 12:24 am


Return to Linux CPU V6 Client

Who is online

Users browsing this forum: No registered users and 1 guest