Results 1 to 9 of 9

Thread: Run folding as service

Hybrid View

  1. #1
    Advisor Outlaw's Avatar
    Join Date
    May 2001
    Location
    Clifton Park, NY
    Posts
    630

    Run folding as service

    Don't know if similar exists, but here's a way to automate starting of Linux folding at home client for Deb and Fedora. Let me know If someting needs to be fixed. Not sure how to make sticky. Will a moderator please make sticky.

    This is a way to use folding as a service in Linux if you prefer to have folding start automatically.

    ===================
    Debian Instructions
    ===================

    Download the Linux folding client
    Place in /usr/local/bin
    as root, run for first time manually and enter your user name and the team number. Then kill with ctrl-c

    then copy and paste this script into /etc/init.d/folding

    Code:
    #!/bin/bash
    #
    # Start Folding At Home execution
    #
    
    FAH=/usr/local/bin/FAH504-Linux.exe
    
    check_binary() {
        if [ ! -e /usr/local/bin/FAH504-Linux.exe ]
            then
                echo "Folding binary is missing or has changed"
            exit
        fi
    }
    
    check_running() {
        COUNT=`ps -ef|grep [F]ah|wc -l`
        if [ $COUNT = 4 ]
        then
            RUN=1
        else
            RUN=0
        fi
    }
    
    case "$1" in
        start)
            check_running
                if [ $RUN = 1 ]
                then
                    echo "Folding seems to be running already"
                    exit
                else
                    /usr/local/bin/FAH504-Linux.exe >/var/log/folding 2>&1 &
                    exit
                fi
            ;;
    
        stop)
            check_running
                if [ $RUN = 1 ]
                then
                    killall FAH504-Linux.exe
                    exit
                else
                    echo "Folding does not seem to be running"
                    exit
                fi
            ;;
    
        status)
            check_running
                if [ $RUN = 1 ]
                then
                    echo "Folding is running"
                    tail -n 5 /var/log/folding|grep -i completed
                    exit
                else
                    echo "Folding does not seem to be running"
                    exit
                fi
            ;;
    esac
    Use sysvconfig to add folding to startup

    Code:
    saturn:~# /etc/init.d/folding status
    Folding is running
    [22:15:27] Completed 0 out of 500000 steps  (0%)
    Code:
    saturn:~# /etc/init.d/folding stop
    saturn:~# /etc/init.d/folding status
    Folding does not seem to be running
    Code:
    saturn:~# /etc/init.d/folding start
    saturn:~# /etc/init.d/folding status
    Folding does not seem to be running
    saturn:~# /etc/init.d/folding status
    Folding is running
    saturn:~# ps -ef|grep [F]ah
    root     26971 26968  2 17:39 pts/64   00:00:00 ./FahCore_82.exe -dir work/ -suffix 01 -checkpoint 15 -lifeline 26967 -version 504
    root     26977 26971  0 17:39 pts/64   00:00:00 ./FahCore_82.exe -dir work/ -suffix 01 -checkpoint 15 -lifeline 26967 -version 504
    root     26978 26977 99 17:39 pts/64   00:00:14 ./FahCore_82.exe -dir work/ -suffix 01 -checkpoint 15 -lifeline 26967 -version 504
    root     26979 26977  0 17:39 pts/64   00:00:00 ./FahCore_82.exe -dir work/ -suffix 01 -checkpoint 15 -lifeline 26967 -version 504
    ===================
    Fedora Instructions
    ===================

    Code:
    #!/bin/bash
    #
    # chkconfig: 35 56 56
    # description: Start Folding At Home execution
    #
    
    FAH=/usr/local/bin/FAH504-Linux.exe
    
    check_binary() {
        if [ ! -e /usr/local/bin/FAH504-Linux.exe ]
            then
                echo "Folding binary is missing or has changed"
            exit
        fi
    }
    
    check_running() {
        COUNT=`ps -ef|grep [F]ah|wc -l`
        if [ $COUNT = 4 ]
        then
            RUN=1
        else
            RUN=0
        fi
    }
    
    case "$1" in
        start)
            check_running
                if [ $RUN = 1 ]
                then
                    echo "Folding seems to be running already"
                    exit
                else
                    /usr/local/bin/FAH504-Linux.exe >/var/log/folding 2>&1 &
                    exit
                fi
            ;;
    
        stop)
            check_running
                if [ $RUN = 1 ]
                then
                    killall FAH504-Linux.exe
                    exit
                else
                    echo "Folding does not seem to be running"
                    exit
                fi
            ;;
    
        status)
            check_running
                if [ $RUN = 1 ]
                then
                    echo "Folding is running"
                    tail -n 5 /var/log/folding|grep -i completed
                    exit
                else
                    echo "Folding does not seem to be running"
                    exit
                fi
            ;;
    esac
    Code:
    [root@Dell-i8500 ~]# chmod 755 /etc/init.d/folding
    [root@Dell-i8500 ~]# chkconfig --add folding
    [root@Dell-i8500 ~]# chkconfig --list|grep folding
    folding         0:off   1:off   2:off   3:on    4:off   5:on    6:off
    Code:
    [root@Dell-i8500 ~]# service folding status
    Folding does not seem to be running
    [root@Dell-i8500 ~]# service folding start
    [root@Dell-i8500 ~]# service folding status
    Folding does not seem to be running
    [root@Dell-i8500 ~]# service folding status
    Folding does not seem to be running
    [root@Dell-i8500 ~]# service folding status
    Folding does not seem to be running
    [root@Dell-i8500 ~]# service folding status
    Folding does not seem to be running
    [root@Dell-i8500 ~]# service folding status
    Folding does not seem to be running
    [root@Dell-i8500 ~]# service folding status
    Folding is running
    
    [root@Dell-i8500 ~]# service folding status
    Folding is running
    [23:47:08] Completed 0 out of 500000 steps  (0%)
    
    [root@Dell-i8500 ~]# service folding stop
    [root@Dell-i8500 ~]# service folding status
    Folding does not seem to be running

  2. #2
    Moderator
    Good Guru
    Compunuts's Avatar
    Join Date
    May 2001
    Location
    California
    Posts
    3,935
    Great, thanks. I will put that into my Ubuntu desktop.
    LinuxVillage - The truely community run Linux/Floss forum !

    No IT BS !!

  3. #3
    Moderator
    Good Guru
    Compunuts's Avatar
    Join Date
    May 2001
    Location
    California
    Posts
    3,935
    Oh and when WiKi got working again, we can put that into DC WiKi as well.
    LinuxVillage - The truely community run Linux/Floss forum !

    No IT BS !!

  4. #4
    Advisor Outlaw's Avatar
    Join Date
    May 2001
    Location
    Clifton Park, NY
    Posts
    630
    Quote Originally Posted by Compunuts
    Oh and when WiKi got working again, we can put that into DC WiKi as well.
    Done

  5. #5
    Moderator
    Good Guru
    Compunuts's Avatar
    Join Date
    May 2001
    Location
    California
    Posts
    3,935
    I was doing it and only got it to creating headlines. Then my mouse in WinXP got stuck (can't copy and paste).
    LinuxVillage - The truely community run Linux/Floss forum !

    No IT BS !!

  6. #6
    Moderator
    Good Guru
    Compunuts's Avatar
    Join Date
    May 2001
    Location
    California
    Posts
    3,935
    I'm using Ubuntu 5.10 and it didn't install sysvconfig package by default. One need to issue "sudo apt-get install sysvconfig" first before trying to configure F@H to start up.

    I can't add this info to WiKi ATM so I'm just keeping a note just in case.
    LinuxVillage - The truely community run Linux/Floss forum !

    No IT BS !!

Similar Threads

  1. TeamOpenFree Folding Logo
    By Compunuts in forum General Chat
    Replies: 5
    Last Post: 05-14-2006, 02:09 AM
  2. IBM's Folding Project
    By BurntAsh in forum Linux - Software, Applications & Programming
    Replies: 0
    Last Post: 11-23-2004, 10:51 AM
  3. The new folding team number ....
    By Compunuts in forum Linux - Software, Applications & Programming
    Replies: 7
    Last Post: 10-02-2004, 04:58 AM
  4. Folding Client 4.0
    By Compunuts in forum Linux - Software, Applications & Programming
    Replies: 0
    Last Post: 06-27-2004, 02:54 PM
  5. Vim's folding functionality (attn vince ;)
    By Feztaa in forum Linux - Software, Applications & Programming
    Replies: 3
    Last Post: 03-23-2002, 03:03 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •