Menu

#75 lm_sensors script update

v7.6
closed-accepted
nobody
None
5
2022-08-11
2022-07-15
No

Analyzing extraneous RPM dependencies, like "mailx" and "crontabs",
also noticed "grep", which is actually used only in "lm_sensors" service script.

While focused on dropping this dependency, pretty much rewrote it:
- drop dependency on external grep
- don't trigger warnings
- faster bailouts
- load POSIX only when needed & don't import anything
- shorten hostname only when appropriate
- less variables, use provided ENVs directly
- exec only when necessary
- (hopefully) less confusing code:
- cleaner code paths, even if more verbose ;-)
- avoid the nasty "and" vs "&&" mess (leading some to parentheses flood syndrome), even if some logwatch script writers seem to love "and" & "or" operators so much ;-)

1 Attachments

Discussion

  • Marius Feraru

    Marius Feraru - 2022-07-15

    Analyzing logwatch source
    - saw that hostname is already provided through ENV;
    - "only_hostname" actually refers to a list of hosts, as defined by "hostlimit".

     
  • Bjorn

    Bjorn - 2022-08-11
    • status: open --> closed-accepted
     
  • Bjorn

    Bjorn - 2022-08-11

    Thanks for the patch.

     

Log in to post a comment.