/usr/share/doc/hddtemp/contribs/analyze/hddtemp_monitor.sh is in hddtemp 0.3-beta15-52.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #!/bin/sh
interval=300
tmpdir="/tmp/results"
drive="/dev/hda"
if [ ! -d "$tmpdir" ] ; then
echo "no such dir: $tmpdir"
exit 1
fi
logger -s -t hddtemp "starting hddtemp monitor: interval=$interval, tmpdir=$tmpdir, drive=$drive"
stamp=`date +%s`
tmpfile_old="$tmpdir/hddtemp-$stamp"
hddtemp $drive --debug > "$tmpfile_old"
while [ 1 ] ; do
sleep $interval
stamp=`date +%s`
tmpfile_new="$tmpdir/hddtemp-$stamp"
hddtemp $drive --debug > "$tmpfile_new"
RETURNED=`diff "$tmpfile_old" "$tmpfile_new"`
if [ -n "$RETURNED" ] ; then
logger -s -t hddtemp "change $tmpfile_new !!!"
tmpfile_old="$tmpfile_new"
else
logger -s -t hddtemp "no change"
rm "$tmpfile_new"
fi
done
|