You are not logged in.

#1 2020-05-22 20:26:22

Spheerys
Member
Registered: 2012-05-01
Posts: 56

How to suspend adfter a while, but not if network or CPU is active ?

I want to be able to suspend (in ram on a first need, but why not hibernate) my computer after a while, but not if my network card if "to much" active, for example when I'm downloading or when I'm making backup.

And ideally, if the CPU is high (because I'm rendering a 3D project for example), I would appreciate don't suspend the computer before the end of the job.

What is the best way to doing this kind of stuff by targeting values for each test ?
Do you have script I can adapt for my needs ?

Thanks smile

Offline

#2 2020-05-22 20:46:08

loqs
Member
Registered: 2014-03-06
Posts: 11,058

Re: How to suspend adfter a while, but not if network or CPU is active ?

Have you considered an alternative approach using systemd-inhibit to block suspend while running a task?

Offline

#3 2020-05-22 21:29:10

Spheerys
Member
Registered: 2012-05-01
Posts: 56

Re: How to suspend adfter a while, but not if network or CPU is active ?

Thanks loqs smile I didn't know this program.

However, it's permit to inhibate the general suspend when it will occurs, so you have to remember to launch it when you have a long task to run.
I wish "not have to remember" way.
On Synology Nas, there is a package which is doing this well : https://sourceforge.net/projects/advpowermgr4ds/

So it should be possible to have the same on a running Linux...

Offline

#4 2020-05-23 07:10:57

seth
Member
Registered: 2012-09-03
Posts: 15,454

Re: How to suspend adfter a while, but not if network or CPU is active ?

This however seems to *trigger* the suspend depending on the system load, not inhibit it.

There three obstacles here:
1. What exactly triggers the autosuspend. Eg. xautolock an run random scripts, but the big DEs rely, I believe, on systemd signals. Not sure to what degree this is manipulatable.
2. System load can happen in bulks and your network traffic can stall on the other side, eg. there might be no traffic for several seconds despite an ongoing download - how do you define "load"?
3. How to abort the pending suspend? eg. you didn't interact, system waits for cpu load to drop, you start typing or moving the mouse. How do you figure that you want to abort the suspend and do you actually want to?

It is abysmally easier to notice that there's been no network I/O for 5 minutes and suspend the system...

Online

Board footer

Powered by FluxBB