If "only when idle" doesn't work

FAH provides a V7 client installer for Debian / Mint / Ubuntu / RedHat / CentOS / Fedora. Installation on other distros may or may not be easy but if you can offer help to others, they would appreciate it.

Moderators: Site Moderators, FAHC Science Team

Post Reply
Barberousse
Posts: 1
Joined: Wed Mar 25, 2020 11:46 am

If "only when idle" doesn't work

Post by Barberousse »

On my Kubuntu 19.10 distribution, "only when idle" does nothing.

To get the same behavior, I changed my config like that (/etc/fahclient/config.xml) removing "idle" option and adding "pause-on-start" option on slots :

Code: Select all

  <!-- Client Control -->
  <fold-anon v='true'/>

  <!-- Slot Control -->
  <power v='FULL'/>

  <!-- User Information -->
  <passkey v='xxxxx'/>
  <team v='xxx'/>
  <user v='xxxxxxxxxx'/>

  <!-- Folding Slots -->
  <slot id='0' type='CPU'>
    <pause-on-start v='true'/>
    <paused v='true'/>
  </slot>
  <slot id='1' type='GPU'>
    <pause-on-start v='true'/>
    <paused v='true'/>
  </slot>
I created a testmonitor script in my /home/user/bin directory

Code: Select all

#!/bin/bash

CMD=/usr/bin/FAHClient
SLEEP_INTERVAL_ON=60
SLEEP_INTERVALL_OFF=10

sleep_interval=$SLEEP_INTERVAL_ON

while true; do

if xset -q | grep -q "Monitor is Off"; then
    new_state=off
else
    new_state=on
fi


if [ "$new_state" != "$old_state" ]; then
    old_state="$new_state"
    if [ "$new_state" == "on" ]; then
        $CMD --send-pause
        sleep_interval=$SLEEP_INTERVAL_ON
    else
        $CMD --send-unpause
        sleep_interval=$SLEEP_INTERVAL_OFF
    fi
fi

sleep $sleep_interval

done
then

Code: Select all

chmod +x /home/user/bin/testmonitor
I added the script to be started automatically on session start:

Code: Select all

kcmshell5 autostart
and added testmonitor as "script" file at startup.

At next session start, the folding will start only when screen is OFF, for instance when you set up DPMS ON on your screen as power saving option.
Last edited by Barberousse on Wed Mar 25, 2020 7:10 pm, edited 1 time in total.
bruce
Posts: 20824
Joined: Thu Nov 29, 2007 10:13 pm
Location: So. Cal.

Re: If "only when idle" doesn't work

Post by bruce »

The IDLE status is detected by the OS and traditionally was used to invoke a screensaver. People no longer use screensavers but one can be used to detect when the OS is telling FAH that it's idle.

Pause-on-start is totally different. It inhibits FAHClient from starting folding immediately after a reboot by initially invoking the FAH PAUSE function for that slot (or all slots).

You can manage the FAHCore activies my manually invoking the PAUSE/UNPAUSE functions or you can expect FAH to do that for you by waiting until the OS indicates taht the Mouse/Keyboard haven't been used recently.

That's pretty much what your script does.
Peter Leslie Goulden
Posts: 8
Joined: Sat Apr 04, 2020 10:38 am
Hardware configuration: 64 bit 8 core AMD FX-8320 processor,
16GB RAM,
NVIDIA GeForce GTX 750 Ti GPU with 2GB RAM,
Asus M5A99FX Pro R2.0 motherboard,
Linux Mint 20, Kernel 5.4.0
Client 7.6.13

Re: If "only when idle" doesn't work

Post by Peter Leslie Goulden »

Thanks Barberousse. I used your script as the basis for a solution on my Linux Mint Cinnamon system with only a few minor modifications to suit my setup. There's also one bug fix. I see this as a temporary workaround until the FAH Client maintainers get around to fixing 'On Idle' properly in the Client as I'm yet to be convinced it works at all in Linux.

Here's my slightly modified version of your testmonitor script:

Code: Select all

#!/bin/bash

CMD=/usr/bin/FAHClient
SLEEP_INTERVAL_ON=60
SLEEP_INTERVAL_OFF=10

sleep_interval=$SLEEP_INTERVAL_ON

while true; do

if [ `xprintidle` -ge $(($SLEEP_INTERVAL_ON * 1000)) ]; then
    new_state=idle
else
    new_state=busy
fi


if [ "$new_state" != "$old_state" ]; then
    old_state="$new_state"
    if [ "$new_state" == "busy" ]; then
        $CMD --send-pause
        sleep_interval=$SLEEP_INTERVAL_ON
    else
        $CMD --send-unpause
        sleep_interval=$SLEEP_INTERVAL_OFF
    fi
fi

sleep $sleep_interval

done
The changes are:
1. Correction to SLEEP_INTERVALL_OFF=10 to remove superfluous 'L'.
2. Changed state names to suit my personal taste.
3. Modified to use xprintidle, which has to be installed on your system, instead of xset. I did this because I wanted the client to activate after only 1 minute of inactivity, rather than when my monitor goes to sleep, which is 30 minutes on my system. (That's 29 wasted minutes, otherwise. :eo )

I set mine to run from 'Startup Applications' on my Mint system rather than using your kcmshell5 command. It's very simple but if anyone needs clear instructions on how to do this then please just ask.

I didn't bother with the client config 'pause-on-start' change. I wasn't sure what it brought to the party.
squidfr
Posts: 1
Joined: Sat Aug 08, 2020 7:03 pm

Re: If "only when idle" doesn't work

Post by squidfr »

bruce wrote: You can manage the FAHCore activies my manually invoking the PAUSE/UNPAUSE functions or you can expect FAH to do that for you by waiting until the OS indicates taht the Mouse/Keyboard haven't been used recently.
Hi @bruce

Allow me to piggy back on your answer. I'd like to avoid running additional scripts and only to use FAH to detect the user is away.
So, I am interested by knowing whether there are some settings I could tweak to have FAH actually detecting neither keyboard nor mouse have been used for some time ?

I have one compter running Manjaro and one running openSUSE Leap. None of them are able to get FAH detecting idling (in the way you define it).

Thanks!
PantherX
Site Moderator
Posts: 6986
Joined: Wed Dec 23, 2009 9:33 am
Hardware configuration: V7.6.21 -> Multi-purpose 24/7
Windows 10 64-bit
CPU:2/3/4/6 -> Intel i7-6700K
GPU:1 -> Nvidia GTX 1080 Ti
§
Retired:
2x Nvidia GTX 1070
Nvidia GTX 675M
Nvidia GTX 660 Ti
Nvidia GTX 650 SC
Nvidia GTX 260 896 MB SOC
Nvidia 9600GT 1 GB OC
Nvidia 9500M GS
Nvidia 8800GTS 320 MB

Intel Core i7-860
Intel Core i7-3840QM
Intel i3-3240
Intel Core 2 Duo E8200
Intel Core 2 Duo E6550
Intel Core 2 Duo T8300
Intel Pentium E5500
Intel Pentium E5400
Location: Land Of The Long White Cloud
Contact:

Re: If "only when idle" doesn't work

Post by PantherX »

Welcome to the F@H Forum squidfr,

May I suggest that you first see how your OS defines and detect idle? Once you know that, the next step would be to set the client to fold when idle.
ETA:
Now ↞ Very Soon ↔ Soon ↔ Soon-ish ↔ Not Soon ↠ End Of Time

Welcome To The F@H Support Forum Ӂ Troubleshooting Bad WUs Ӂ Troubleshooting Server Connectivity Issues
bruce
Posts: 20824
Joined: Thu Nov 29, 2007 10:13 pm
Location: So. Cal.

Re: If "only when idle" doesn't work

Post by bruce »

What he said. :ewink:

It's the code in the OS that reports idle/not-idle to FAH. (In most cases, the same signal is observed by screen-saver code to open that app.)
Post Reply