Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19
Run folding as service
Results 1 to 9 of 9

Thread: Run folding as service

  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
    Last edited by Outlaw; 03-05-2006 at 12:42 AM.

    To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


    To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


    To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

  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.

    To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
    - 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.

    To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
    - 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

    To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


    To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


    To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

  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).

    To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
    - 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.

    To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
    - The truely community run Linux/Floss forum !

    No IT BS !!

  7. #7
    Advisor Outlaw's Avatar
    Join Date
    May 2001
    Location
    Clifton Park, NY
    Posts
    630
    Quote Originally Posted by Compunuts
    One need to issue "sudo apt-get install sysvconfig" first before trying to configure F@H to start up.
    Good catch, added.

    To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


    To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


    To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

  8. #8
    Moderator
    Good Guru
    Compunuts's Avatar
    Join Date
    May 2001
    Location
    California
    Posts
    3,935
    One more question, does your script automatically create "folding" log file in /var/log ? If not, then one need to manually create it. Right? Then what should permission be? I don't think doing 777 would be secure but 760? I'm not really familiar with file permission setting in secure environment.

    To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
    - The truely community run Linux/Floss forum !

    No IT BS !!

  9. #9
    Advisor Outlaw's Avatar
    Join Date
    May 2001
    Location
    Clifton Park, NY
    Posts
    630
    You brought up a good point. That folding log file in /var/log is redundant in that a log is automatically generated by folding in the home dir of the user executing it. The reason I have it going to /var/log is to keep consistent with how services usually log.

    To answer your question, the log file is automatically created by redirecting stdout and stderr to that file, and the permissions will default to root's umask. So it should default to 644 perms if you have the normal umask. The file will be wiped out each time the service is restarted, but that's not so bad since there's a log made by FAH in root's home that appends each time.

    A mode of 644 is a little more permissive than you want for a secure env. Perhaps a chmod on that file to 600 is in order?

    I added that chmod into the Wiki

    To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


    To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


    To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

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
  •