noob linux question...regarding running progs at startup

nst6563

2[H]4U
Joined
Sep 15, 2003
Messages
4,023
I've just setup a linux box here, well actually I'm messing with Smoothwall for the time being, and was wondering just how I get F@H to run automatically at startup. I added it to the rc.sysinit with a line at the end like:
/fah/fah.exe

and when smoothwall boots, it runs F@H like it should, but it doesn't run it in the background. IE, start f@h and then bring up the login prompt.

if I leave it as it is...is the system any more unsecure than normal?

any help would be appreciated.
 
You should write a script to start folding. As the way ytou are starting it now will put the folding files probably in / instead of in your /fah directory.

Here's an example-

#!/bin/sh
cd /fah
./fah > /dev/null &


Save this as a text file and name it something like "fold". Make it execuable with chmod-

chmod +x fold

move it to /bin

in rc.sysinit, change the line you added to be-

/bin/fold


This should work.... There are often problems starting things out of rc.sysinit on smoothwall. You could also try inittab or cron if that fails. I've been posting about this on ocforums too trying to help smoothwall users set folding up as a service, but I'm not operating in smoothwall, so I'm at a slight disadvantage....
 
Out of curiosity for someone trying to learn Linux, could you do a brief explanation of that script?

I get most of it, the change dir, executing F@H, and changing it to be executable, but why the > /dev/null & ? What does that do?
 
the > and < are special characters that will redirect the output or input to a different location. (input is a little more complicated, focus on output for now) normally commands will take input from stdin (this is like when you pipe ps through grep; grep is recieving standard input.) and output things such as errors to stdout (usually the current console.) so all output of completed tasks for fah will be printed to a console. if you are running fah as a background service and dont care about status messages, the > /dev/null will redirect all text output to /dev/null, which was once explained to me as a 'magical hole in the sky.' :cool: anything inputted to it will disapear, which is useful in situations like this where you dont want any output. the input redirector < is less used, although can be useful in more advanced scripting.

the & on the end of any command will put it in the background, so after you run it your prompt will immediatly return and you can continue using your command line, however the first process will still be running. a backgrounded process will still print output to its console though. for a test of &, try running updatedb (or any other time consuming task) with and without the &.
 
ok, I put that script in there, and had to make a change b/c it wasn't actually running the fah. I had to change the line ./fah to ./fah.exe. Now the script works...but I'm not quite sure it's working where I have it in rc.sysinit. It's at the end, and if I understand right, the system kills all processes that aren't daemons when rc.sysinit exits...which would kill fah since it's not a daemon.

Would it be better to put it in inittab like was suggested? Where would I put it in there, the end or does it really matter?

thanks!
 
thanks, I'll try that when I get home.
I assume the :3: means start after 3 minutes and the once means only execute one time?

sorry, I'm a noob again to linux (it's been like 3 years since I used a linux box, and back then I bounced from Redhat to Suse to Slackware), but I do a lot of scripting on windows systems.
 
Pretty sure the 3 is for runlevel 3 (isn't this the default for smoothwall, text mode boot?)...
 
ok...I've gotten it to load via inittab. Works fine...although when I view my folding stats, it still only shows that I have 2 cpus folding when it should be 3 (wife's pc, mine, and the linux box router/firewall). I've checked the client.cfg and the settings are correct, I've even checked to make sure it's starting in the right folder to be using the right client.cfg and it is...so at this point I'm stumped.

I'd like to get credit for it running....
 
Each client file should have a unique id (not machine ID, but a long string of characters). You'll see this in the FAHlog.txt anytime the client is started... Also note, that the cpu count will be updated within 4-8 hours of turning in a WU for that week.

Here's another script for you- I call it viewfold

#!/bin/sh
FoldDir=/root/fah
more $FoldDir/FAHlog.txt | tail -18



It will display the end of the folding logfile. chmod it and stick it in /bin

less /root/fah/FAHlog.txt
is another way to check your whole folding logfile.
 
sweet! thanks!

I'll give that a shot when I get home. I'll also check the machine ID too. It's running in the background b/c when I run ps -wefaux it the FAHcore shows up using %99 cpu...so at least its running. Does it show completed units in the log also?
 
Yup. And if smoothwall has a gui, and can install software like superkaramba, I've got a grpahical folding monitor to sdisplay a transperantapplet on the desktop much like the windows program samurize.... Not that you probably do much with your routerbox as far as using it directly......
 
Arkaine23 said:
Yup. And if smoothwall has a gui, and can install software like superkaramba, I've got a grpahical folding monitor to sdisplay a transperantapplet on the desktop much like the windows program samurize.... Not that you probably do much with your routerbox as far as using it directly......


nope, Smoothwall doesn't have a gui that I'm aware of. just command line, which is fine with me since it's just a router box. It does however have a WEB interface. I suppose with a little research and editing, you could add such a thing (or something like it) to the web interface under the status page.
 
ok, I made and ran that script...however I get an error:

[19:50:18] - Ask before connecting: No
[19:50:18] - User name: nst6563 (Team 33)
[19:50:18] - User ID: 344902DE2D1A62D2
[19:50:18] - Machine ID: 1
[19:50:18]

A potential conflict was detected:

Process 272 is currently running and may also be a client with Mach. ID 1.
Program will now exit. Upon restart, this check will not be done --
you may wish to check that no client is currently running in
/fah before restarting.


is this my problem why I'm not seeing 3 cpu's folding?


:EDIT:
I think part of my problem not being able to see the 3rd cpu on my folding page is b/c it hasn't finished a WU yet! I was looking through the log file...and it's finished 76 frames....out of 426! :eek:


So...from that, I was wondering if anyone knw how to re-compile the Smoothwall kernel to support dual cpu's??? I've got an Abit BP6 here with a couple 500Mhz celery's that is in need of serious repair. So this weekend I was going to replace all the caps on it (like 90% of them are blown) and give it a go. Even with one cpu running, it'll be at least as fast as the single PII-400 I have running at 500 now.

:EDIT2:
Nevermind on recompiling the kernel...figured it out. got it covered...now to just swap the mb this weekend after the repair! :D

btw...does the FAH client utilize 2 cpu's??? sweetness if it did. ;)
 
I believe I read somewhere that in order to utilize a dual CPU setup, you have to run 2 instances of FAH. Then set an affinity for each proc.
 
why don't they write those programs to take advantage of a multiple cpu system? would it no t be more efficient/beneficial to utilize both cpu's at %100 with the same instance of the program than to utilize 1 cpu at %100 for 2 instances which would be working on different WU's??
 
Ok, FAH not starting issue- sounds like you maybe had it running manually and then it launched a second time. Or perhaps it started out of both inittab and rc.sysinit . Did you remove the line you'd added to rc.sysinit?


dual-cpu issue- folding can utilize multpile cpu's. Just install multiple fah clients and give them a different machine ID # [1-8] in their client.cfg's. Also set them up in seperate directories. There would be no advantage in making the client SMP-capable in an of itself.
 
well, FAH seems to be loading ok now.

how can I tell that the system sees both cpu's now? (couldn't wait so I did the mb repair and swapped them out this evening) The boot info flys by so fast now that I can't read it.
 
two cpu's-

/cat/proc/cpuinfo


Two folding's- make a new folding dir right alongside your current folding dir. Edit the startup script you made and add two additional lines-

cd /root/fah2
./fah.exe > /dev/null &


Now after the script launches the first client, it cd's to the 2nd client directory and then laucnes the 2nd client. Simple.

Just copy the client.cfg to the 2nd folding directory, and then edit it with a text editor to change the machine ID number.
 
thanks for the proc info. at first I didn't realize it was a text file, but when I did, I opened it in vi and it had both my cpu's there :D happy I am now.


I already did the 2nd instance of fah and put it in inittab also.

it looks as if I've got just about everything running on there now that I wanted. Reactive Firewall, Ad blocking, Content Filtering (not active yet though), time server, virus scanner, and http server.

Thanks for all the help...the linux stuff is *slowly* coming back...guess that's what happens when you haven't used it in years...
 
Back
Top