Package: hddtemp
Version: 0.3-beta13-1

Hello,

although I've chosen hddtemp not to run as daemon, because I don't like
it to listen on some ports, I'd like it to syslog drive temperatures.
Currently, this is impossible: As soon as I choose it to syslog, it
listens on 127.0.0.1:7634.
The commandline invoked by the init script is:
/usr/sbin/hddtemp -d -l 127.0.0.1 -p 7634 -s | -S 60 /dev/hda /dev/hdc /dev/hde 
/dev/hdg

This is a quite misleading interpretation of the semantics suggested
via debconf and moreover it is not neccesarily needed: If I start it
manually with
/usr/sbin/hddtemp -S 60 /dev/hda /dev/hdc /dev/hde /dev/hdg
it does exactly what I want.

So, perhaps adding `-d -l 127.0.0.1 -p 7634 -s |' if RUN_DAEMON=true
and adding `-S 60' if SYSLOG!=0 would be more consistent.

The patch attached tries to achieve this. It further contains my
suggested fix for #302061 and it secures the cdrom-sortout a bit
(grep -w).
The patch will not work with any of $INTERFACE, $PORT or $SEPARATOR
containing spaces. However, this wouldn't have worked before, too :)


Thanks for your work & regards
   Mario
-- 
Um mit einem Mann gluecklich zu werden, muss man ihn sehr gut
verstehen und ihn ein bisschen lieben.
Um mit einer Frau gluecklich zu werden, muss man sie sehr lieben
und darf erst gar nicht versuchen, sie zu verstehen.
--- /etc/init.d/hddtemp.orig    2005-03-29 17:28:42.000000000 +0200
+++ /etc/init.d/hddtemp 2005-03-30 00:47:10.000000000 +0200
@@ -25,6 +25,9 @@
 # Reads config file (will override defaults above)
 [ -r /etc/default/hddtemp ] && . /etc/default/hddtemp
 
+if [ "$RUN_DAEMON" = "true" -o "$RUN_DAEMON" = "yes" ] ; then
+       DAEMON_ARG="-d -l $INTERFACE -p $PORT -s $SEPARATOR"
+fi
 if [ -n "$SYSLOG" -a "$SYSLOG" != "0" ] ; then
        SYSLOG_ARG="-S $SYSLOG"
 fi
@@ -34,19 +37,18 @@
 case "$1" in
   start)
        # master switch
-       if [ "$RUN_DAEMON" = "true" -o "$RUN_DAEMON" = "yes" -o -n 
"$SYSLOG_ARG" ] ; then
+       if [ -n "$DAEMON_ARG" -o -n "$SYSLOG_ARG" ] ; then
                echo -n "Starting $DESC:"
                CDROMS_LIST="$(grep "^drive name:" /proc/sys/dev/cdrom/info 
2>/dev/null | sed -e 's/^drive name:\t//g' -e 's/\t/ \/dev\//g')"
+               CDROMS_LIST="$CDROMS_LIST $(grep -sl '^ide-scsi ' 
/proc/ide/hd*/driver | awk -F / '{ print "/dev/"$4 }')"
                for disk in $DISKS ; do
-                       if echo $CDROMS_LIST | grep -q $disk ; then 
-                               continue
-                       fi
+                       echo $CDROMS_LIST | grep -wq $disk && continue
                        if /usr/sbin/hddtemp -wn $OPTIONS $disk 2>/dev/null | 
/bin/grep -q '^[0-9]\+$' ; then
                                DISKS_LIST="$DISKS_LIST $disk";
                        fi
                done
                if [ -n "$DISKS_LIST" ] ; then
-                       start-stop-daemon --start --quiet --exec $DAEMON -- -d 
-l $INTERFACE -p $PORT -s $SEPARATOR $SYSLOG_ARG $OPTIONS $DISKS_LIST
+                       start-stop-daemon --start --quiet --exec $DAEMON -- 
$DAEMON_ARG $SYSLOG_ARG $OPTIONS $DISKS_LIST
                        echo "$DISKS_LIST."
                else
                        echo " no disks with monitoring capability were found."

Reply via email to