Skip to content

Commit

Permalink
fancontrol: Uplift the --check option
Browse files Browse the repository at this point in the history
 - do not duplicate the load code
 - add description to man page
  • Loading branch information
hramrach committed Feb 17, 2024
1 parent ee3ba9e commit 9a7c75d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
14 changes: 7 additions & 7 deletions prog/pwm/fancontrol
Original file line number Diff line number Diff line change
Expand Up @@ -390,15 +390,11 @@ function CheckFiles
return $outdated
}

CHECK_ONLY=false
if [ "$1" == "--check" ]
then
if [ -f "$2" ]
then
LoadConfig $2
else
LoadConfig /etc/fancontrol
fi
exit 0
CHECK_ONLY=true
shift
fi

if [ -f "$1" ]
Expand All @@ -408,6 +404,10 @@ else
LoadConfig /etc/fancontrol
fi

if $CHECK_ONLY ; then
exit 0
fi

# Detect path to sensors
if echo "${AFCPWM[0]}" | grep -E -q '^/'
then
Expand Down
12 changes: 10 additions & 2 deletions prog/pwm/fancontrol.8
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,22 @@
fancontrol \- automated software based fan speed regulation

.SH SYNOPSIS
.B fancontrol
.I [configfile]
.B fancontrol [
.I --check
.B ] [
.I configfile
.B ]

.SH DESCRIPTION
\fBfancontrol\fP is a shell script for use with lm_sensors. It reads its
configuration from a file, then calculates fan speeds from temperatures and
sets the corresponding PWM outputs to the computed values.

.SH OPTIONS
.IP "--check"
Check configuration file end exit. This option can be used for verifying the
configuration before starting fancontrol as a service in the background.

.SH WARNING
Please be careful when using the fan control features of your mainboard, in
addition to the risk of burning your CPU, at higher temperatures there will be
Expand Down

0 comments on commit 9a7c75d

Please sign in to comment.