nosuspend - avoid computer suspend as long a app is running

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

Post Reply
tramp
Established Member
Posts: 2347
Joined: Mon Jul 01, 2013 8:13 am
Has thanked: 9 times
Been thanked: 466 times

nosuspend - avoid computer suspend as long a app is running

Post by tramp »

Hi

After some discussions with @wolftune, I wrote a little app to allow users to avoid temporary computer suspend on systemd based systems.

nosuspend allows users to avoid suspend or shutdown even on privileged level (e.g. root) when a running user process shouldn't be interrupted. for example capture a session.
To accomplish this, nosuspend sets the systemd-inhibit flag with UID 0/root in order to block computer suspend while another command-line operation is running.
Permissions therefore are granted in a PolKit policy rule file which comes with nosuspend.
nosuspend comes in 2. fashions, e.g. with 2 different Polkit files.

1.) default is the security mode, which requires you to enter the root password in order to run nosuspend.

2.) is the relaxed mode, which allow you to run nosuspend without password. To get this mode, you must build nosuspend with

Code: Select all

make relaxed 
Sure, you could switch of suspend at all, but maybe that's not what you wont. So nosuspend may be the tool for you.
To use nosuspend, simply run before another command as in:

Code: Select all

nosuspend appname -parameter for appname
For easy command substitution full bash completion support is provided.

here you go:
https://github.com/brummer10/nosuspend

regards
hermann
On the road again.
Post Reply