My IPv6 tunnel has a tendency to vanish from time to time. So I
thought I might write a script to check that and attempt
reconstituting it if needed. After some considerable messing
about, I really thought this ...
#!/bin/sh
if ifconfig en1|grep -q "inet6 2001" ; then exit;
else
if ps -ax | grep gw6c | grep -qv grep;
then ps -ax | grep gw6c | grep -v grep | ( read x y; kill "$x" )
fi
cd /usr/local/gw6c/bin
./gw6c
fi
... should work. But I was wrong, as usual. In the case where
the tunnel has vanished, the gw6c program often does not quit
right away, and it is usually soaking up a lot of processor in
that mode. Thus it was necessary to test for gw6c running and
terminate it if it was. Curiously, even when it was not
running. the test above would fail in the script. On the
command line, it seemed, as near as I could tell, to work just
fine.
Grasping at straws, I decided to try the following:
#!/bin/sh
if ifconfig en1|grep -q "inet6 2001" ; then exit;
else
if $( ps -ax | grep gw6c | grep -qv grep );
then ps -ax | grep gw6c | grep -v grep | ( read x y; kill "$x" )
fi
cd /usr/local/gw6c/bin
./gw6c
fi
It worked just fine. I'd like to know why this disparity. It's
probably something mind bogglingly simple but my researches
have yet to unboogle me. Can you?
--
Walter M. Pawley <[email protected]>
Wump Research & Company
676 River Bend Road, Roseburg, OR 97471
541-672-8975
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[email protected]"