[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Debian]: start-stop-daemon und pidfiles?



Hi!

Ich möchte gerne alles, was an DNS-Anfragen über mein ippp0-Interface
geht, zu Debugzwecken mitloggen. Dafür habe ich ein
/etc/ppp/ip.d/-Skript geschrieben, das so aussieht:

|mh@torres:/mnt/main6/home/mh > cat /etc/ppp/ip.d/dns-tcpdump
|#!/bin/bash
|
|PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|NAME="tcpdump-dns"
|DAEMON="/usr/local/sbin/tcpdump"
|PARM="-l -s 256 -vvv -i $PPP_IFACE udp port 53"
|
|case "$PPP_OPERATION" in
|  up)
|        logger -t $PPP_IFACE "starting tcpdump"
|        echo "logging DNS traffic on $PPP_IFACE" >> /var/log/dns-tcpdump
|        start-stop-daemon --start --quiet \
|                --pidfile /var/run/$NAME.pid \
|                --exec $DAEMON -- $PARM >> /var/log/dns-tcpdump &
|        logger -t $PPP_IFACE "started tcpdump with pid `cat /var/run/$NAME.pid`"
|        ;;
|  down)
|        logger -t $PPP_IFACE "killing tcpdump with pid `cat /var/run/$NAME.pid`"
|        start-stop-daemon --stop --quiet \
|                --pidfile /var/run/$NAME.pid
|        echo "end log of DNS traffic on $PPP_IFACE" >> /var/log/dns-tcpdump
|        ;;
|esac
|mh@torres:/mnt/main6/home/mh >

Leider scheint das Stoppen von tcpdump nicht zu funktionieren. pidfile
funktioniert nicht, weil tcpdump kein pidfile von sich aus anlegt und
start-stop-daemon das pidfile nur prüft, um zu gucken, ob ein solcher
Prozeß vielleicht schon läuft. Ich habe also nichts, was das pidfile
anlegen könnte.

--exec will ich nicht benutzen, da es zum Zeitpunkt des
Verbindungsabbau noch andere tcpdump-Instanzen geben könnte und
start-stop-daemon so nicht weiß, welches tcpdump es killen soll.

Irgendwelche Ideen, wie dieses Problem zu lösen ist?

Grüße
Marc

-- 
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber          |   " Questions are the         | Mailadresse im Header
Karlsruhe, Germany  |     Beginning of Wisdom "     | Fon: *49 721 966 32 15
Nordisch by Nature  | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29
------------------------------------------------
Um sich aus der Liste auszutragen schicken Sie
bitte eine E-Mail an majordomo@jfl.de die im Body
"unsubscribe debian-user-de <deine emailadresse>"
enthaelt.
Bei Problemen bitte eine Mail an: Jan.Otto@jfl.de
------------------------------------------------
Anzahl der eingetragenen Mitglieder:     743


Reply to: