Download Latest Version loadavgd-1.1.tar.xz (8.0 kB)
Email in envelope

Get an email when there's a new version of loadavgd

Home
Name Modified Size InfoDownloads / Week
README 2024-05-03 2.3 kB
loadavgd.c 2024-05-03 5.2 kB
loadavgd-1.1.tar.xz 2024-05-03 8.0 kB
sleep_systemd.c 2021-06-29 5.1 kB
sleep_systemd.h 2021-06-29 1.4 kB
parse_config.h 2021-06-29 2.3 kB
loadavgd-1.0.tar.xz 2021-06-29 7.9 kB
parse_config.c 2021-06-29 5.5 kB
loadavgd.conf 2021-06-29 1.1 kB
loadavgd.service 2021-06-29 262 Bytes
loadavgd.8.gz 2021-06-29 1.3 kB
loadavg.service 2016-01-10 204 Bytes
loadavgd.tar.xz 2016-01-10 4.7 kB
Totals: 13 Items   45.3 kB 0
loadavgd - Monitor CPU load and terminal activity

The loadavgd program monitors the CPU load and user input at (pseudo-)
terminals. It provides a kind of power management for server systems,
where desktop environments are not available, and the common notion of
a system being idle if interactive activity is missing does not apply.
Currently, loadavgd depends on systemd components.

If the load is below a certain treshold and there is no input at any
(pseudo-) terminal for a given amount of time, a command is issued.
This command must be one of those which the session manager,
systemd-logind, understands on its DBus API, org.freedesktop.login1.

Loadavgd is configured via a configuration file, usually
/etc/loadagvd.conf. A systemd service file is provided.


COMPILATION AND INSTALLATION

Compile with

    $CC -o loadavgd -O2 loadavgd.c parse_config.c sleep_systemd.c -lsystemd

Optionally, use -DDEBUG to have loadavgd output additional messages. Further
compilation and linking options might be -fpie -pie -flto.

Install,

    cp loadavgd		/usr/local/sbin/
    cp loadavgd.conf	/etc/
    cp loadavgd.service	/etc/systemd/system/
    cp loadavgd.8.gz	/usr/local/share/man/man8/

Start systemwide with

    systemctl start loadavgd

Start at each following boot

    systemctl enable loadavgd

Reload the configuration file,

    systemctl reload loadavgd

Terminate,

    systemctl stop loadavgd


Depending on the configured action, by default suspend, it might also be
possible to start loadavgd as user. It will write diagnostic messages to
stderr. Loadavgd will exit if it cannot run as ordinary user. Loadavgd
takes one argument, the location of the configuration file. If not
given, this defaults to /etc/loadavgd.conf,

    ./loadavgd loadavgd.conf

Reload the configuration file by sending SIGHUP to the process,

    pkill -HUP loadavgd

Terminate with

    pkill loadavgd


NOTES

To query terminal input, loadavgd reads the modification time of the
pseudo terminal multiplexer /dev/ptmx. User input resets the modifica‐
tion time of /dev/ptmx, but output from a program, for instance status
lines printed repeatedly from a long-running process, does not alter
any time stamp of /dev/ptmx. (In this case, the modification time of
the appropriate terminal slave, e.g., /dev/pts/0, would be updated.)
Source: README, updated 2024-05-03