On 3/11/02 at 1:46 AM, Matt Schalit <[EMAIL PROTECTED]> wrote:

> guitarlynn wrote:

> The section below needs a little more work.  The syntax shown
> will overwrite forward.txt.
> 
> cp /var/log/messages /mnt/messages.txt
> ip addr show > /mnt/address.txt
> ipchains -nvL > /mnt/filter.txt
> /usr/sbin/ipmasqadm mfw -nL > /mnt/forward.txt
> /usr/sbin/ipmasqadm portfw -nl > /mnt/forward.txt
> cat /proc/net/ip_masq/autofw > /mnt/forward.txt
> 
> 
> And I request again that you add in
> 
>      ip route show > /mnt/routes.txt
> 
> and remove the netstat -rn, only because ip route show
> is on every distro (correct?)

Not really....  May I recommend:

( echo "Messages log\n"
cat /var/log/messages
echo

if which ip 2> /dev/null ; then
   ip addr show
   echo
   ip route show
else
   ifconfig -a
   echo
   netstat -rn
fi
echo

if which ipchains 2> /dev/null ; then
   ipchains -L -v -n
else
   iptables -L -v -n
fi
echo

if which ipmasqadm 2> /dev/null ; then
   ipmasqadm mfw -L -n
   echo
   ipmasqadm portfw -n -l
   echo
   cat /proc/net/ip_masq/autofw
   echo
fi

) > /tmp/sysdata.txt

This has several advantages:

1. Single file at the end for details - /tmp/sysdata.txt - just attach
and mail.  If you use "matt" (new package to attach files to mail!)
you can even mail it right from the box.

2. Testing for existance of programs allows clean execution in even
the most spartan (or odd) environments.  No ip?  No problem.  No
ipchains?  No problem....

3. Using a single file saves some space (constant redirections and
filenames).  Of course, with all the testing (using which) the end
result is more bytes - but it's worth it, I think.
--
David Douthitt
UNIX Systems Administrator
HP-UX, Unixware, Linux
[EMAIL PROTECTED]

_______________________________________________
Leaf-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-devel

Reply via email to