mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-11-19 19:40:49 +00:00
sensors-save: New debug tool for saving sensor data from sysfs
This commit is contained in:
1 parent
905634f182
commit
9aa83ee190
2 files changed
+114
No files matched your search
Executable
+64
@@ -0,0 +1,64 @@
|
||||
#!/bin/sh
|
||||
|
||||
verbose=true
|
||||
|
||||
while [ "$*" != "" ] ; do
|
||||
case $1 in
|
||||
-q) verbose=false ; shift;;
|
||||
*) break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ $# -ne 1 ] ; then
|
||||
echo Usage: "$0 [ -q ] target" >&2
|
||||
exit 22
|
||||
fi
|
||||
|
||||
target="$1"
|
||||
prefix=/sys
|
||||
set -e
|
||||
|
||||
set -- /class/hwmon
|
||||
|
||||
while [ -n "$1" ] ; do
|
||||
source="$1" ; shift
|
||||
src="$prefix$source"
|
||||
tgt="$target$source"
|
||||
if [ -e "$tgt" ] ; then
|
||||
! $verbose || echo "$tgt already exists"
|
||||
continue
|
||||
fi
|
||||
if [ -L "$src" ] ; then
|
||||
link="$(readlink "$src")"
|
||||
! $verbose || echo "$tgt -> $link"
|
||||
ln -s "$link" "$tgt"
|
||||
link="/$(realpath --relative-to="$prefix" -s "$(dirname "$src")"/"$link")"
|
||||
set -- "${link}" "$@"
|
||||
continue
|
||||
fi
|
||||
if [ -d "$src" ] ; then
|
||||
! $verbose || echo "$tgt/"
|
||||
mkdir -p "$tgt"
|
||||
sub="$(ls -A "$src")" # cannot use a pipeline, it creates new parameter scope
|
||||
while [ -n "$sub" ] ; do
|
||||
x=$(echo "$sub" | head -n 1)
|
||||
sub="$(echo "$sub" | tail -n +2)"
|
||||
[ "$x" != autosuspend_delay_ms ] || continue # these files cause io error
|
||||
set -- "$source/$x" "$@"
|
||||
done
|
||||
continue
|
||||
fi
|
||||
if [ -f "$src" ] ; then
|
||||
! $verbose || echo "$tgt"
|
||||
if [ -r "$src" ] ; then
|
||||
cp -a "$src" "$tgt" ||: # some files gitve i/o error even when readable
|
||||
else
|
||||
! $verbose || echo "$tgt not readable"
|
||||
touch --reference="$src" "$tgt"
|
||||
chmod --reference="$src" "$tgt"
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
done
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,50 @@
|
||||
.\" Copyright 1999 Frodo Looijaard <frodol@dds.nl>
|
||||
.\" Copyright (C) 2007-2012 Jean Delvare <jdelvare@suse.de>
|
||||
.\" sensors is distributed under the GPL
|
||||
.\"
|
||||
.\" Permission is granted to make and distribute verbatim copies of this
|
||||
.\" manual provided the copyright notice and this permission notice are
|
||||
.\" preserved on all copies.
|
||||
.\"
|
||||
.\" Permission is granted to copy and distribute modified versions of this
|
||||
.\" manual under the conditions for verbatim copying, provided that the
|
||||
.\" entire resulting derived work is distributed under the terms of a
|
||||
.\" permission notice identical to this one
|
||||
.\"
|
||||
.\" Since the Linux kernel and libraries are constantly changing, this
|
||||
.\" manual page may be incorrect or out-of-date. The author(s) assume no
|
||||
.\" responsibility for errors or omissions, or for damages resulting from
|
||||
.\" the use of the information contained herein. The author(s) may not
|
||||
.\" have taken the same level of care in the production of this manual,
|
||||
.\" which is licensed free of charge, as they might when working
|
||||
.\" professionally.
|
||||
.\"
|
||||
.\" Formatted or processed versions of this manual, if unaccompanied by
|
||||
.\" the source, must acknowledge the copyright and authors of this work.
|
||||
.\"
|
||||
.TH sensors-save 1 "January 2024" "lm-sensors 3" "Linux User's Manual"
|
||||
.SH NAME
|
||||
sensors-save \- save sensor data
|
||||
.SH SYNOPSIS
|
||||
.B sensors-save [ -q ]
|
||||
.I location
|
||||
|
||||
.SH DESCRIPTION
|
||||
.B location
|
||||
directory where sensor data is saved. Saved data can then be used by specifying
|
||||
.I location
|
||||
in the
|
||||
.I SENSORS_SYSFS_ROOT
|
||||
environment variable.
|
||||
.br
|
||||
Saved data can be used for diagnosing problems in data interpretation and other testing.
|
||||
|
||||
.SH OPTIONS
|
||||
.IP "-q"
|
||||
Do not print file names as they are copied.
|
||||
|
||||
.SH AUTHOR
|
||||
Michal Suchánek and the lm_sensors group
|
||||
https://hwmon.wiki.kernel.org/lm_sensors
|
||||
|
||||
|
||||
Reference in new issue
Block a user