debug Q

debug Q

Post by jtoy » Tue, 22 Aug 2000 04:00:00



Can you guys help me to debug my homegrown beginner's script?  It gets
called when an internet connection goes up.  Its supposed to bring down
the internet if 30 packets arent transmitted within 20 seconds.  I know
there are thing like diald, but I am trying to practice writing some of
my own stuff.  I think the problem has to do with sleep because when I
do a ps -uawx I can see that this script has its own pid and sleep has
its own pid.  When I manually bring up the connection and then run this
script it works ok, but If I run the internet script to start internet
with ifup ppp0, then run this script, it never kills the internet
connection, but this script does start to run.  Thanks and do you guys
have better ideas for doing this kind of stuff in bash?
Jason Toy

http://toy.eyep.net
------------------------------------------------------------
#!/bin/bash
date >> /pub/output
sleep 20s
if (ping www.yahoo.com -c 2); then
  seq=1
  while [ -f /pub/output ]; do
    rm /pub/output
    tcpdump -i ppp0 -c 30 > /pub/output &
    kpid2=$!
    sleep 20s
    if (kill $kpid2); then
      echo "internet can go down"
      ifdown ppp0
      /etc/cron.daily/km
      rm /pub/output
    else
      echo "still have live connection"
      echo 'Sequence: '$seq
      seq=$(( $seq + 1 ))
    fi
  done
fi
 
 
 

debug Q

Post by jtoy » Tue, 22 Aug 2000 04:00:00


btw, I used 'date' just to fill in some space.

> Can you guys help me to debug my homegrown beginner's script?  It gets
> called when an internet connection goes up.  Its supposed to bring down
> the internet if 30 packets arent transmitted within 20 seconds.  I know
> there are thing like diald, but I am trying to practice writing some of
> my own stuff.  I think the problem has to do with sleep because when I
> do a ps -uawx I can see that this script has its own pid and sleep has
> its own pid.  When I manually bring up the connection and then run this
> script it works ok, but If I run the internet script to start internet
> with ifup ppp0, then run this script, it never kills the internet
> connection, but this script does start to run.  Thanks and do you guys
> have better ideas for doing this kind of stuff in bash?
> Jason Toy

> http://toy.eyep.net
> ------------------------------------------------------------
> #!/bin/bash
> date >> /pub/output
> sleep 20s
> if (ping www.yahoo.com -c 2); then
>   seq=1
>   while [ -f /pub/output ]; do
>     rm /pub/output
>     tcpdump -i ppp0 -c 30 > /pub/output &
>     kpid2=$!
>     sleep 20s
>     if (kill $kpid2); then
>       echo "internet can go down"
>       ifdown ppp0
>       /etc/cron.daily/km
>       rm /pub/output
>     else
>       echo "still have live connection"
>       echo 'Sequence: '$seq
>       seq=$(( $seq + 1 ))
>     fi
>   done
> fi


 
 
 

1. slab.c ATOMIC debug check to immediately trap atomic abuse while debugging

Hi.

The attached patch extends slab debugging with an early check if ATOMIC
is required. The patch is relative to 2.4.20 but may also be interesting
for 2.5.

Normally the atomic requirement is only verified when the slab cache
needs to grow, but with this patch such errors is detected immediately
on first call if slab debugging is enabled.

This patch would have saved me from panic bug hunting after a system was
sent into production as the errors then would have been trapped
immediately during development. Probably many others would be helped by
this slab debugging to trap stupid memory allocation / locking errors
early on in development.

Regards
Henrik Nordstr?m
MARA Systems AB, Sweden

  slab_atomic_debug.patch
< 1K Download

2. aliases in subshells with tcsh

3. : Kernel debugging (saving debug info)

4. etherboot-3.0b2 - boot Linux on diskless PC

5. Newbie: Different behaviour between debug and non-debug

6. UNIX curses applications

7. etting debug flags doesn't help with debugging.

8. VCRON: visual cron/at interface

9. to debug or not to debug (was Re: Hiring Unix programming interns - writing an online quiz)

10. Erasing sw - stupid qs

11. Two Debian 2.0 Qs

12. Easy Qs for ya

13. 2 Qs: How to register and where is _calendar_ or _remind_ ?