How to start, stop, check status and stats of F@H from CLI

Moderators: Site Moderators, FAHC Science Team

Post Reply
whisked_away
Posts: 3
Joined: Wed Mar 24, 2021 1:17 pm

How to start, stop, check status and stats of F@H from CLI

Post by whisked_away »

I have the `fahclient` running on my Linux server headlessly. I can see it in `htop` when I ssh into the server.

I want to be able to check the stats on the command line. I can just do it locally on the machine its running on, since I have ssh access, but I cant figure out how I am supposed to communicate with the running Folding At Home client.

If I have my GUI set up, I can load

Code: Select all

https://client.foldingathome.org/
in the web browser, and I can run `FAHControl` as well to get more detailed info and set configurations. But I cannot figure out how to perform all these same functions from the command line.

Of course I saw the "command line only" instructions here;

Code: Select all

https://foldingathome.org/support/faq/installation-guides/linux/command-line-options/
but I am still not clear how I am supposed to use this, because Folding At Home is set by default to start running on system boot, so I never actually have a chance to run these commands

I guess a more general guide for how to start, stop, monitor, and configure new and running `fahclient` instances is what I really need.
Joe_H
Site Admin
Posts: 7867
Joined: Tue Apr 21, 2009 4:41 pm
Hardware configuration: Mac Pro 2.8 quad 12 GB smp4
MacBook Pro 2.9 i7 8 GB smp2
Location: W. MA

Re: How to start, stop, check status and stats of F@H from C

Post by Joe_H »

Welcome to the folding support forum.

The page on the command line is about all the official documentation available. You may also want to check out the information of the third party FAHClient API - https://github.com/FoldingAtHome/fah-co ... Client-API.

From the command line you have two different approaches available. First you use telnet or the equivalent to connect to the running FAHClient process:

telnet 127.0.0.1 36330

That will connect you to a command prompt, there is a built in help available.

The second approach is to use the FAHClient command at the command line, there you can use it to query the running background process and send commands to it.

I wrote a post recently that provided the output of the help commands for both connecting via telnet and FAHClient --help, that is here - viewtopic.php?f=61&t=36875&hilit=+telnet#p349661.
Image

iMac 2.8 i7 12 GB smp8, Mac Pro 2.8 quad 12 GB smp6
MacBook Pro 2.9 i7 8 GB smp3
whisked_away
Posts: 3
Joined: Wed Mar 24, 2021 1:17 pm

Re: How to start, stop, check status and stats of F@H from C

Post by whisked_away »

Thanks, I will check those out

another thing I realize is that I can also enable X11 forwarding with `ssh -X myserver.local` and then when I run the command `FAHControl` it will open in a local GUI window. This worked when logging into my Linux server from my Mac (with XQuartz installed).
whisked_away
Posts: 3
Joined: Wed Mar 24, 2021 1:17 pm

Re: How to start, stop, check status and stats of F@H from C

Post by whisked_away »

I have another question (issue?).

On my system, I wanted to disable Folding At Home on startup, so I used the command

Code: Select all

sudo systemctl disable FAHClient.service
This worked, and F@H stopped running at boot.

But later I wanted to start F@H again. I tried to start it manually by running the script located at

Code: Select all

/etc/init.d/FAHClient
however, this failed to launch and gave me some error messages.

So I tried to just restart the systemctl service;

Code: Select all

sudo systemctl start FAHClient.service
But F@H failed to start. The command did not seem to do anything.

So finally I just re-enabled the service at boot with

Code: Select all

sudo systemctl enable FAHClient.service
and it started normally at boot again. However, this was kinda annoying because it forced me to reboot the machine. I do not want to have to reboot the machine every time I want to pause a currently running F@H systemctl service then restart it.

I am guessing this is not the method you are supposed to be using to stop and restart FAHClient? If I have it starting on boot via systemctl should I not try to stop/start it via systemctl commands? And should I not try to run the `/etc/init.d/FAHClient` script myself manually?
Joe_H
Site Admin
Posts: 7867
Joined: Tue Apr 21, 2009 4:41 pm
Hardware configuration: Mac Pro 2.8 quad 12 GB smp4
MacBook Pro 2.9 i7 8 GB smp2
Location: W. MA

Re: How to start, stop, check status and stats of F@H from C

Post by Joe_H »

What you probably are running into is that recent versions of Linux are moving away from init.d scripts, and how well they work for F@h can depend on which particular version and distribution you are running. Some have posted here on how to convert the setup done by the installer.

Basically for Linux, its installer dates from a few years ago when Ubuntu 16.04 and 18.04 and similar versions of other Linux distractions were current. There have been updates to the component parts over the last year to fix some bugs and add the COVID preference. Some future release will include updates to the installer, but I have no information on when that might come out.

However, about the only reason stopping and starting FAHClient outside of a system reboot that is recommended is to have it reread its configuration after changes to the network or related settings require that. Otherwise FAHClient when folding is not active uses almost no resources.

What is recommended if you don't want folding to start at boot time is to add the option 'pause-on-start' set to 'true'. This can either be added to the folding slot setup, and than will only apply to that slot. Or it can apply to all slots by adding it as an Extra Client Option under the Expert tab of the FAHControl Configure screen.
Image

iMac 2.8 i7 12 GB smp8, Mac Pro 2.8 quad 12 GB smp6
MacBook Pro 2.9 i7 8 GB smp3
bruce
Posts: 20910
Joined: Thu Nov 29, 2007 10:13 pm
Location: So. Cal.

Re: How to start, stop, check status and stats of F@H from C

Post by bruce »

Why are you stopping FAHClient? Have you ever considered stopping the service that streams data to your printer? No, because you simply don't print anything for a while and the service has noting to do. Leave FAHClient running and arrange for there to be nothing for it to do.

I can think of no particular reason stop FAHClient. Instead, what you should do is PAUSE or FINISH the WUs in individual slots. The tasks that do FAH's heavy processing use either CPU or GPU resources to calculate at close to 100% utilization are called FAHCore_*. Suspending them is amazingly effective at reducing the use of processing resources. (When you restart them, the WU will restart from the last checkpoint, so you'll have to repeat a small amount of processing.) Sending the appropriate PAUSE or FINISH command to the appropriate slot(s) will take care of the issue.

FAHClient primary responsibility is to manage internet I/O, which takes next to nothing in resources. If a slot isn't processing, nothing will be completed until it resumes work, so no completed WUs will need to be uploaded or new ones downloaded -- so the FAHClient's service will have nothing to do.

In rare instances, a completed WU will have trouble reaching the designated server and FAHClient will keep trying occasionally, but that's hardly enough processing for you to notice.
gunnarre
Posts: 567
Joined: Sun May 24, 2020 7:23 pm
Location: Norway

Re: How to start, stop, check status and stats of F@H from C

Post by gunnarre »

whisked_away wrote:But later I wanted to start F@H again. I tried to start it manually by running the script located at

Code: Select all

/etc/init.d/FAHClient
To add to earlier replies, Linux tries to make systemctl and init.d-scripts (SysVinit) work together in compatibility mode, but stopping and restarting FAH that way doesn't always work that way. Or it might actually stop, but give an error message, so check if it actually started.
Image
Online: GTX 1660 Super, GTX 1080, GTX 1050 Ti 4G OC, RX580 + occasional CPU folding in the cold.
Offline: Radeon HD 7770, GTX 960, GTX 950
Post Reply