View Full Version : Folding in linux
I'm having some dificulties folding in linux. I downloaded the 5.02 linux file from stanford, but it was an exe and it wouldn't start. I know I have gotten it to work before in linux, but I don't remember. Also, how do you set it up to restart after a reboot?
{PMS}fishy
03-11-05, 09:17 PM
chmod +x filename.exe
./filename.exe
As far as auto starting it, you can write a cron job, or a script. There are some option posted in the stickies.
Wait a sec... Can you explain a little more please? I'm kind of a newbee to linux.
samuraisam
03-11-05, 10:03 PM
Are you using a Window Manager?
If so, open the terminal.
cd ~/where/ever/your/exe/is/located
chmod +x FAH502-Linux.exe
./FAH502-Linux.exe -advmethods -verbosity 9 -forceasm
First, you're getting to your dir
Second, you're making it so you can execute it
Third you're executing it
-Sam
penquissciguy
03-11-05, 10:39 PM
If you're running gentoo, you can "emerge foldingathome" and it will install the client and allow you to configure it as a startup service. Works great for me.
Ken
samuraisam
03-11-05, 10:40 PM
If you're running gentoo, you can "emerge foldingathome" and it will install the client and allow you to configure it as a startup service. Works great for me.
Woohooo!!
-Sam :clap:
nope, running elx (everyone's linux). My brother uses gentoo, but I'm too much of a noob for it. :(
samuraisam
03-12-05, 12:01 AM
Did you get it figured out?
-Sam
I got it running, but I don't think its going to restart on boot. I don't have any programing skills at all, so I'm not sure what to do.
Arkaine23
03-12-05, 01:18 PM
From my post in the Ultimate FAH install Guide sticky-
If you follow these instructions, folding will run as a service on your linux box. It will start at boot-time. You will also create a few custom commands that will make it easy to stop, start, reconfigure user/team, and view the folding logfile with simple one-word commands. So this goes a bit beyond just a service install.
Part 1. Shell scripting
These scripts will make managing your folding a little easier and will be step one in setting it up as an automatic service. Only a very slight familiarity with linux is assumed.
Create some new text files by right-clicking your desktop and choosing create new text file. Paste the following scripts into these new text files. For all of these scripts, change the FoldDir variable so that it points to your actual folding directory. For the purposes of this guide, you will also want to make sure to rename your folding client .exe file to FAH502-Linux.exe. If you have not already, you need to make FAH502-Linux.exe executable.
cd /your/folding/directory
(I suggest /home/your_username/fold for the folding directory)
chmod +x FAH502-Linux.exe
Note: I use -advmethods and -forceasm as examples throughout these scripts because I fold big packets. Be sure you know which flags are best for your CPU when using this guide to write your own scripts. At this time, enabling big packets in client.cfg and -advmethods -forceasm is best if you have at least 256mb ram and an SSE-capable CPU.
Script I (I usually name this one foldon)
#!/bin/sh
#This script starts folding@home as a background service
# it uses gromacs flags
# Change your FoldDir variable to refelct your actual folding directory's location
# your folding client's .exe should be named FAH502-Linux.exe
FoldDir=/path/to/your/folding
cd $FoldDir
./FAH502-Linux.exe -advmethods -forceasm > /dev/null &
echo "Starting F@H service..."
Script II (I call this one viewfold)
#!/bin/sh
# This script displays a portion of the folding log file
# tail -20 can be set to any number you want, just not too large
# that will be the number of lines displayed
# Change your FoldDir variable to refelct your actual folding directory's location
FoldDir=/path/to/your/folding
more $FoldDir/FAHlog.txt | tail -20
Script III ( I call this one foldoff)
#!/bin/sh
# This script safely kills folding@home
killall -15 FAH502-Linux.exe
Script IV (this one's optional. Its an easy way to reset the client.cfg file)
#!/bin/sh
#This script starts folding@home and uses gromacs flags
# It also runs the -config option to let you enter new user information
# Change your FoldDir variable to reflect your actual folding directory's location
# your folding client's .exe should be named FAH502-Linux.exe
FoldDir=/path/to/your/folding
cd $FoldDir
./FAH502-Linux.exe -configonly
Part 2. Preparing the scripts for use.
Now, hopefully you've got some new text files and have saved them and named them. The name will also be the command to launch the script from a terminal.
Now you'll want to move them to a location where other executables are kept. I suggest /usr/local/bin. You might need to be root in order to write to that directory, so become root by using the su command. Replace your_user_name in the commands below with your normal username. I assume these files are on your desktop.
su
(enter root's password)
mv /home/your_username_here/Desktop/foldon /usr/local/bin
mv /home/your_username_here/Desktop/foldoff /usr/local/bin
mv /home/your_username_here/Desktop/cfgfold /usr/local/bin
mv /home/your_username_here/Desktop/viewfold /usr/local/bin
Now you need to make these scripts executable.
cd /usr/local/bin
chmod +x foldon
chmod +x foldoff
chmod +x viewfold
chmod +x cfgfold
(That can probably all be done as one command, but for new linux users, repetition of common commands is a good thing. )
Part 3. Making it start when the system boots
This procedure can vary depending on the distro you have. You will either be entering a command into a file (rc.local method), or you will be creating a link to your script in a startup folder (rc5.d method). You should still be root, but if not, become root with the su command.
su
(enter root's password)
Look at your system's /etc directory for some specific files.
cd /etc
ls
You want to find rc.local if it exists. Or if it doesn't, then rc5.d, rc3.d, and rc2.d.
For rc.local:
Open rc.local with a text editor. If you have one you like, good. My example uses vi.
vi rc.local
(press the i key to insert text and type the following line, but replace "your_username" with your normal username)
su -c "/usr/local/bin/foldon" your_username
(To save in vi, press the escape key followed by a :wq and then press enter.)
For rc5.d, rc3.d, and rc2.d:
These folders contain shortcuts to system services (also called init scripts because these scripts can be issued to start, stop, or restart system services). Rc5.d is run control 5 which means the stuff isnside it runs when you boot straight to graphical mode (default from many distros and especially preferred by newbies). Rc3.d and rc2.d are both run levels that go to a text prompt, aka text mode. The difference between them is that rc3.d starts more networking services than rc2.d. If you are unsure you can edit all three of these, though you actually only boot into one of these run levels by default.
ln -s /usr/local/bin/foldon /etc/rc5.d/S99foldon
Step 4. Optional, and only needed if you modified the rc#.d file(s). If you edited rc.local, skip this section.
One problem is that folding will be run by root instead of by an ordinary user. This is not a big deal, but you should run it as a normal user for the sake of this paranoid administrator.
You can leave it as is, or you can do this one last step:
cd /usr/local/bin
cp foldon fold
vi foldon
(press the i key to insert text. Here's what you're looking at. The text in red is what you need to add.)
#!/bin/sh
#This script starts folding@home as a background service
# it uses gromacs flags
# Change your FoldDir variable to refelct your actual folding directory's location
# your folding client's .exe should be named FAH4Console.exe
FoldDir=/path/to/your/folding
cd $FoldDir
su -c "./FAH502-Linux.exe -advmethods -forceasm > /dev/null & " your_username_here
(Make sure to replace your_username_here with your normal username. Save the file by pressing escape and then :wq and enter)
Run this command as root to make sure the permissions for everything are set correctly:
chown -R username:username /your/folding/directory
(where username is the user who will be running folding@home)
Launch the client for the first time as the regular folding user with the cfgfold script and configure it.
Part 5. Congratulations!!
It's not very hard to make desktop icon shortcuts to your scripts or to place shortcuts in a "quick launch bar" in the same style as a windows system. Tune in next time for more Linux tweaking tips....
Please report any errors in this how-to so that they can be corrected ASAP. Updated for v5.02 folding@home.
samuraisam
03-12-05, 01:42 PM
For Linux Command Line Install
1. Create a directory reserved for the Folding@Home Client, if you do not have one already. This can be accomplished by typing `mkdir [path-to-directory]` in the terminal. For example, I keep my client /home/fah1 so I would type `mkdir /home/fah1`.
2. Change permissions on that directory to full permissions for the owner, and read/execute permissions for everybody else. This can be accomplished by typing `chmod 755 [path-to-directory]` in the terminal. In my case, this would be `chmod 755 /home/fah1`.
3. Change permissions on your Folding@Home Client next. Do this by typing `chmod 755 [path-to-client]/FAH502-Linux.exe` in the terminal. In my case, `chmod 755 /home/samuraisam/FAH502-Linux.exe`, because I downloaded it to /home/samuraisam.
4. Move your Folding@Home Client to the directory you created earlier. Do this by typing `mv [path-to-client]/FAH502-Linux.exe [path-to-directory]` in the terminal. For me, this would be `mv /home/hpxchan/FAH502-Linux.exe /home/fah1/`.
5. Change the current directory to the Folding@Home Client's new directory by typing `cd [path-to-directory]` in the terminal. In my case, I would type `cd /home/fah1`.
6. Run the Folding@Home Client with the -configonly flag to configure it for the first time. Do this by typing `./FAH502-Linux.exe -configonly` in the terminal. Enter your desired username and 32 for the team number when prompted.
7. To run the Folding@Home Client silently (after you have configured it in step 6), change the current directory to the Folding@Home Client's directory by typing `cd [path-to-client]` in the terminal (again, in my case, this would be `cd /home/fah1`). Next, run the client silently by typing in the terminal `./FAH502-Linux.exe [flags] [your-shell's-method-of-output-redirection]`. In the following code example, I run the Folding@Home Client with my desired flags (flags are out of the scope of this tutorial), and silence it, using the bash shell (it should work just as well on sh, among a few others):
bash: `./FAH502-Linux.exe -forceasm -advmethods -verbosity 9 >/dev/null 2>&1 &`
If you don't want to type those commands every time to start the Folding@Home client, you could create a simple script to do it for you. In my example, this script is named startfah, and it runs on the sh shell (for ultimate compatibility).
startfah:
#!/bin/sh
cd /home/fah1
./FAH502-Linux.exe -forceasm -advmethods -verbosity 9 >/dev/null 2>&1 &
echo "FAH502-Linux started!"
To make F@H Automagically start at startup
You have many options available to you, but it is often easiest simply to make use of Cron. Assuming your startup script resides at /usr/sbin/startfah and you want to run it as root, add this line to the end of the crontab (usually /etc/crontab), and you're set:
@reboot root exec /usr/sbin/startfah
Alternatively, you could run `crontab -e` to invoke an editor on your user's crontab, and enter in:
@reboot exec /usr/sbin/startfah
-Sam
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.