HomeFreeBSD

sysutils/nut*: Add upslog support for multiple UPSs

Description

sysutils/nut*: Add upslog support for multiple UPSs

upslog is a utility that logs UPS status at regular intervals, specified
by the -i option. Unfortunately upslog supports only on UPS. For sites
that need to monitor multiple UPSs the options are to cobble an rc script
for each or doctor up the nut_upslog.in script to support cloning of the
script. Unfortunately an rc script capable of being cloned would become
the source of more PRs and would require significanly more tehcnical
documentation that by itself might become confusing for the average
system administrator.

Therefore a new -m option is added to support multiple UPSs using the
same invocation of upslog. The patch parses a -m option and forks
almost immediately following the getopt(3) invokation to monitor each
individual UPS using a separate upslog process. This is not ideal but
better than scripting. Lightweight threads might be a better solution.

An rc.conf exemple of how to use this new feature:
nut_upslog_flags="-p /var/db/nut/upslog.pid -m ups1@localhost,/var/log/nut\
/ups1.log,/var/db/nut/ups1.pid -m ups1@localhost,/var/log/nut/ups2.log,/var\
/db/nut/ups2.pid"

Sending a TERM signal to the parent PID, kill cat /var/db/nut/upslog.pid,
will terminate the entire process tree.

This patch submitted upstream, is in the process of being refined and
accepted.

PR: 265963
Reported by: vvd@unislabs.com

Details