Results 1 to 9 of 9

Thread: Run folding as service

Threaded 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

Similar Threads

  1. Microsoft Security Bulletin MS05-004
    By regix in forum Windows - General Topics
    Replies: 0
    Last Post: 02-26-2005, 02:20 AM
  2. Release notes for Windows XP Service Pack 2
    By regix in forum Windows - General Topics
    Replies: 0
    Last Post: 01-04-2005, 07:53 AM
  3. List of fixes included in Windows XP SP2
    By regix in forum Windows - General Topics
    Replies: 6
    Last Post: 01-03-2005, 11:44 PM
  4. SharePoint Portal Server 2003 Service Pack 1
    By regix in forum Windows - General Topics
    Replies: 0
    Last Post: 01-01-2005, 09:26 PM
  5. Windows XP Service Pack 2: The 10% Problem
    By genesis in forum Windows - General Topics
    Replies: 9
    Last Post: 09-25-2004, 02:51 PM

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
  •