mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-10 11:05:54 +02:00
collectd: run sensors-detect in background
on some machines the i2c sensor search take very long time which cause hang at first boot. Now the search is started in background and waited for max one minute before continue load of collectd. On such machines collectd will not get all sensors at first startup. fixes #12329 Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org> Reviewed-by: Michael Tremer <michael.tremer@ipfire.org> Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
This commit is contained in:
@@ -6,6 +6,28 @@
|
||||
|
||||
eval $(/usr/local/bin/readhash /var/ipfire/main/settings)
|
||||
|
||||
scan_for_sensors() {
|
||||
touch /var/lock/sensors_search
|
||||
# pre scan and try to load modules
|
||||
"yes" | /usr/sbin/sensors-detect > /dev/null
|
||||
if [ -e /etc/sysconfig/lm_sensors ]; then
|
||||
|
||||
# Module load
|
||||
. /etc/sysconfig/lm_sensors
|
||||
for modul in $BUS_MODULES $HWMON_MODULES ; do
|
||||
modprobe $modul > /dev/null 2>&1;
|
||||
done
|
||||
fi
|
||||
|
||||
# Final scan
|
||||
"yes" | /usr/sbin/sensors-detect > /dev/null
|
||||
|
||||
if [ ! -e /etc/sysconfig/lm_sensors ]; then
|
||||
echo "#No Sensors detected " > /etc/sysconfig/lm_sensors
|
||||
fi
|
||||
rm /var/lock/sensors_search
|
||||
}
|
||||
|
||||
if [ "$RRDLOG" = '' ]; then
|
||||
RRDLOG=/var/log/rrd
|
||||
fi
|
||||
@@ -42,28 +64,24 @@ case "$1" in
|
||||
|
||||
# At first run search for sensors with sensors-detect
|
||||
if [ ! -e /etc/sysconfig/lm_sensors ]; then
|
||||
boot_mesg "Searching for Sensors..."
|
||||
|
||||
# pre scan and try to load modules
|
||||
"yes" | /usr/sbin/sensors-detect > /dev/null
|
||||
if [ -e /etc/sysconfig/lm_sensors ]; then
|
||||
|
||||
# Module load
|
||||
. /etc/sysconfig/lm_sensors
|
||||
for modul in $BUS_MODULES $HWMON_MODULES ; do
|
||||
modprobe $modul > /dev/null 2>&1;
|
||||
done
|
||||
fi
|
||||
|
||||
# Final scan
|
||||
"yes" | /usr/sbin/sensors-detect > /dev/null
|
||||
evaluate_retval
|
||||
|
||||
if [ ! -e /etc/sysconfig/lm_sensors ]; then
|
||||
echo "#No Sensors detected " > /etc/sysconfig/lm_sensors
|
||||
fi
|
||||
# Don't run at next boot again
|
||||
touch /etc/sysconfig/lm_sensors
|
||||
boot_mesg -n "Searching for Sensors..."
|
||||
scan_for_sensors &
|
||||
sleep 2
|
||||
fi
|
||||
|
||||
if [ -e /var/lock/sensors_search ]; then
|
||||
for (( i=1; i<30; i++)) do
|
||||
if [ ! -e /var/lock/sensors_search ]; then
|
||||
break;
|
||||
fi
|
||||
boot_mesg -n "."
|
||||
sleep 2
|
||||
done
|
||||
fi
|
||||
boot_mesg ""
|
||||
|
||||
# Load sensor modules only first start
|
||||
if [ ! -e /var/lock/sensors_modules ]; then
|
||||
touch /var/lock/sensors_modules
|
||||
|
||||
Reference in New Issue
Block a user