Firefox创造了一项吉尼斯世界记录
我们创造了一项吉尼斯世界记录──24小时内软件下载次数最多。凭借您的帮助我们达到了8,002,530次下载
您现在不仅是一项世界记录的一员,还是最好一版Firefox的拥有者!
我的证书。
闲人生活
vim 是一个增强的"vi"风格的编辑器,大多数UNIX和Linux系统都已经作为默认安装,也有windows下的版本可供使用。它非常适合于程序员使用,而不适合一个普通使用者使用,只有你熟练使用它的命令,才能发挥它的强大威力。使用命令:nscd -i hosts
有关nscd守护进程的说明参照下面的说明。
NAME
nscd - name service cache daemon
SYNOPSIS
/usr/sbin/nscd [-f configuration-file] [-g] [-e cachename, yes
| no] [-i cachename]
DESCRIPTION
The nscd daemon is a process that provides a cache for most
name service requests. The default configuration-file
/etc/nscd.conf determines the behavior of the cache daemon.
See nscd.conf(4).
nscd provides caching for the passwd(4), group(4), hosts(4),
ipnodes(4), exec_attr(4), prof_attr(4), user_attr(4), eth-
ers(4), rpc(4), protocols(4), networks(4), bootparams(4),
audit_user(4), auth_attr(4), services(4), netmasks(4),
printers(4), project(4) databases through standard libc
interfaces, such as gethostbyname(3NSL),
getipnodebyname(3SOCKET), gethostbyaddr(3NSL), and others.
Each cache has a separate time-to-live for its data; modify-
ing the local database (/etc/hosts, /etc/resolv.conf, and so
forth) causes that cache to become invalidated upon the next
call to nscd. The shadow file is specifically not cached.
getspnam(3C) calls remain uncached as a result.
nscd also acts as its own administration tool. If an
instance of nscd is already running, commands are passed to
the running version transparently.
When running with per-user lookups enabled (see
nscd.conf(4)), nscd forks one and only one child process
(that is, a per-user nscd) on behalf of the user making the
request. The per-user nscd will use the credentials of the
user to open a per-user connection to the name repository
configured for the per-user style of lookups. The lookup
will be performed in the child process. The results are
cached in the process and are available only to the same
user. The caches are managed exactly the same as the main
nscd daemon manages its own caches. Subsequent requests from
the user will be handled by that per-user nscd until it ter-
minates. The per-user nscd uses a configurable inactivity
time-to-live (TTL) value and terminates itself after the
inactivity TTL expires.
The maximum number of per-user nscds that can be created by
the main nscd is configurable (see nscd.conf(4)). After the
maximum number of them are created, the main nscd will use
an LRU algorithm to terminate less active child nscds as
needed.
The main nscd daemon creates, monitors, and manages all the
child nscds. It creates a user's own nscd upon receiving the
user's first per-user lookup. When the nscd daemon is
started, if per-user lookups are enabled, it checks to
ensure all conditions are met before getting ready to create
a per-user nscd. When the daemon is stopped, it terminates
all the per-user nscds under its control.
Per-user nscds use the same configuration as the main nscd.
They read and use the same default configuration file or the
one specified with the -f command line option. Once the con-
figuration is read, the per-user nscd will use it for its
entire lifetime.
OPTIONS
Several of the options described below require a cachename
specification. Supported values for cachename are: passwd,
group, hosts, ipnodes, exec_attr, prof_attr, user_attr, eth-
ers, rpc, protocols, networks, bootparams, audit_user,
auth_attr, services, netmasks, printers, and project.
-f configuration-file
Causes nscd to read its configuration data from the
specified file.
-g
Prints current configuration and statistics to standard
output. This is the only option executable by non-root
users.
-e cachename, yes|no
Enables or disables the specified cache.
-i cachename
Invalidate the specified cache.
EXAMPLES
Example 1 Stopping and restarting the nscd daemon.
example# svcadm disable system/name-service-cache
example# svcadm enable system/name-service-cache
FILES
/etc/nscd.conf Determines athe behavior of the cache daemon.
ATTRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
____________________________________________________________
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|_____________________________|_____________________________|
| Availability | SUNWcsu |
|_____________________________|_____________________________|
SEE ALSO
svcs(1), svcadm(1M), getspnam(3C), gethostbyname(3NSL),
getipnodebyname(3SOCKET), audit_user(4), auth_attr(4), boot-
params(4), ethers(4), exec_attr(4), group(4), hosts(4), net-
masks(4), networks(4), nscd.conf(4), nsswitch.conf(4),
passwd(4), printers(4), prof_attr(4), project(4), proto-
cols(4), rpc(4), services(4), user_attr(4), attributes(5)
NOTES
The output from the -g option to nscd is subject to change.
Do not rely upon it as a programming interface.
The nscd service is managed by the service management facil-
ity, smf(5), under the service identifier:
svc:/system/name-service-cache
Administrative actions on this service, such as enabling,
disabling, or requesting restart, can be performed using
svcadm(1M). The service's status can be queried using the
svcs(1) command.
已经正确运行了dns,并配置了xiaojf.com这个域名。域名及其MX记录都指向了本机的ip:192.168.1.21。为了测试MX记录的正确性,通过mail命令发邮件测试。发现如下问题:
1. mail root@localhost 能正确发送。
2. mail root@xiaojf.com 不能发送,返回的邮件中有如下的提示信息。
553 5.3.5 mail.xiaojf.com. config error: mail loops back to me (MX problem?)
554 5.3.5 Local configuration error
大致的意思就是,邮件返回给自己了,MX记录的问题?
通过这个MX记录,sendmail不能自己给自己发邮件。
解决办法,在sendmail.cf文件中添加 Cwxiaojf.com ,得到解决,你会发现 Cwlocalhost 也在。哈哈,我对sendmail.cf是非常不熟悉,但是找了半天总算解决了。
nicstat 是一个c语言编写的统计网卡流量的工具。按照我们习惯的 KB/s 为单位进行显示,非常方便。
bash-3.00# ./nicstat 5
Time Int rKB/s wKB/s rPk/s wPk/s rAvs wAvs %Util Sat
22:58:03 lo0 0.00 0.00 0.71 0.71 0.00 0.00 0.00 0.00
22:58:03 vmxnet0 0.14 0.99 1.54 2.53 94.01 399.7 0.00 0.00
Time Int rKB/s wKB/s rPk/s wPk/s rAvs wAvs %Util Sat
22:58:08 lo0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
22:58:08 vmxnet0 0.01 0.07 0.20 0.40 60.00 186.0 0.00 0.00
Time Int rKB/s wKB/s rPk/s wPk/s rAvs wAvs %Util Sat
22:58:13 lo0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
22:58:13 vmxnet0 0.01 0.08 0.20 0.40 60.00 211.5 0.00 0.00
Time Int rKB/s wKB/s rPk/s wPk/s rAvs wAvs %Util Sat
22:58:18 lo0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
22:58:18 vmxnet0 0.01 0.08 0.20 0.40 60.00 211.5 0.00 0.00
源码在此处
#!/usr/bin/perl -w
#
# nicstat - print network traffic, Kbyte/s read and written.
# Solaris 8+, Perl (Sun::Solaris::Kstat).
#
# "netstat -i" only gives a packet count, this program gives Kbytes.
#
# 30-Sep-2006, ver 1.00 (check for new versions, http://www.brendangregg.com)
#
# USAGE: nicstat [-hsz] [-i int[,int...]] | [interval [count]]
#
# -h # help
# -s # print summary output
# -z # skip zero lines
# -i int[,int...] # print these instances only
# eg,
# nicstat # print summary since boot
# nicstat 1 # print continually, every 1 second
# nicstat 1 5 # print 5 times, every 1 second
# nicstat -i hme0 # only examine hme0
#
# This prints out the KB/s transferred for all the network cards (NICs),
# including packet counts and average sizes. The first line is the summary
# data since boot.
#
# 字段含义:
# Int 接口
# rKB/s 读 千字节/秒
# wKB/s 写 千字节/秒
# rPk/s 读 包/秒
# wPk/s 写 包/秒
# rAvs 读的平均值, 单位字节
# wAvs 写的平均值, 单位字节
# %Util %Utilisation (r+w/ifspeed)
# Sat Saturation (defer, nocanput, norecvbuf, noxmtbuf)
#
# NOTES:
#
# - Some unusual network cards may not provide all the details to Kstat,
# (or provide different symbols). Check for newer versions of this program,
# and the @Network array in the code below.
# - Utilisation is based on bytes transferred divided by speed of the interface
# (if the speed is known). It should be impossible to reach 100% as there
# are overheads due to bus negotiation and timing.
# - Loopback interfaces may only provide packet counts (if anything), and so
# bytes and %util will always be zero. Newer versions of Solaris (newer than
# Solaris 10 6/06) may provide loopback byte stats.
# - Saturation is determined by counting read and write errors caused by the
# interface running at saturation. This approach is not ideal, and the value
# reported is often lower than it should be (eg, 0.0). Reading the rKB/s and
# wKB/s fields may be more useful.
#
# SEE ALSO:
# nicstat.c # the C version, also on my website
# kstat -n hme0 [interval [count]] # or qfe0, ...
# netstat -iI hme0 [interval [count]]
# se netstat.se [interval] # SE Toolkit
# se nx.se [interval] # SE Toolkit
#
# COPYRIGHT: Copyright (c) 2006 Brendan Gregg.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# (http://www.gnu.org/copyleft/gpl.html)
#
# Author: Brendan Gregg [Sydney, Australia]
#
# 18-Jul-2004 Brendan Gregg Created this.
# 07-Jan-2005 " " added saturation value.
# 07-Jan-2005 " " added summary style (from Peter Tribble).
# 23-Jan-2006 " " Tweaked style.
# 11-Aug-2006 " " Improved output neatness.
# 30-Sep-2006 " " Added loopback, tweaked output.
use strict;
use Getopt::Std;
use Sun::Solaris::Kstat;
my $Kstat = Sun::Solaris::Kstat->new();
#
# Process command line args
#
usage() if defined $ARGV[0] and $ARGV[0] eq "--help";
getopts('hi:sz') or usage();
usage() if defined $main::opt_h;
my $STYLE = defined $main::opt_s ? $main::opt_s : 0;
my $SKIPZERO = defined $main::opt_z ? $main::opt_z : 0;
# process [interval [count]],
my ($interval, $loop_max);
if (defined $ARGV[0]) {
$interval = $ARGV[0];
$loop_max = defined $ARGV[1] ? $ARGV[1] : 2**32;
usage() if $interval == 0;
}
else {
$interval = 1;
$loop_max = 1;
}
# check for -i,
my %NetworkOnly; # network interfaces to print
my $NETWORKONLY = 0; # match on network interfaces
if (defined $main::opt_i) {
foreach my $net (split /,/, $main::opt_i) {
$NetworkOnly{$net} = 1;
}
$NETWORKONLY = 1;
}
# globals,
my $loop = 0; # current loop number
my $PAGESIZE = 20; # max lines per header
my $line = $PAGESIZE; # counter for lines printed
my %NetworkNames; # Kstat network interfaces
my %NetworkData; # network interface data
my %NetworkDataOld; # network interface data
$main::opt_h = 0;
$| = 1; # autoflush
### Determine network interfaces
unless (find_nets()) {
if ($NETWORKONLY) {
print STDERR "ERROR1: $main::opt_i matched no network interfaces.\n";
}
else {
print STDERR "ERROR1: No network interfaces found!\n";
}
exit 1;
}
#
# Main
#
while (1) {
### Print Header
if ($line >= $PAGESIZE) {
if ($STYLE == 0) {
printf "%8s %7s %7s %7s %7s %7s %7s %7s %7s %6s\n",
"Time", "Int", "rKB/s", "wKB/s", "rPk/s", "wPk/s", "rAvs",
"wAvs", "%Util", "Sat";
}
elsif ($STYLE == 1) {
printf "%8s %8s %14s %14s\n", "Time", "Int", "rKB/s", "wKB/s";
}
$line = 0;
}
### Get new data
my (@NetworkData) = fetch_net_data();
foreach my $network_data (@NetworkData) {
### Extract values
my ($int, $rbytes, $wbytes, $rpackets, $wpackets, $speed, $sat, $time)
= split /:/, $network_data;
### Retrieve old values
my ($old_rbytes, $old_wbytes, $old_rpackets, $old_wpackets, $old_sat,
$old_time);
if (defined $NetworkDataOld{$int}) {
($old_rbytes, $old_wbytes, $old_rpackets, $old_wpackets,
$old_sat, $old_time) = split /:/, $NetworkDataOld{$int};
}
else {
$old_rbytes = $old_wbytes = $old_rpackets = $old_wpackets
= $old_sat = $old_time = 0;
}
#
# Calculate statistics
#
# delta time
my $tdiff = $time - $old_time;
# per second values
my $rbps = ($rbytes - $old_rbytes) / $tdiff;
my $wbps = ($wbytes - $old_wbytes) / $tdiff;
my $rkps = $rbps / 1024;
my $wkps = $wbps / 1024;
my $rpps = ($rpackets - $old_rpackets) / $tdiff;
my $wpps = ($wpackets - $old_wpackets) / $tdiff;
my $ravs = $rpps > 0 ? $rbps / $rpps : 0;
my $wavs = $wpps > 0 ? $wbps / $wpps : 0;
# skip zero lines if asked
next if $SKIPZERO and ($rbps + $wbps) == 0;
# % utilisation
my $util;
if ($speed > 0) {
# the following has a mysterious "800", it is 100
# for the % conversion, and 8 for bytes2bits.
$util = ($rbps + $wbps) * 800 / $speed;
$util = 100 if $util > 100;
}
else {
$util = 0;
}
# saturation per sec
my $sats = ($sat - $old_sat) / $tdiff;
#
# Print statistics
#
if ($rbps ne "") {
my @Time = localtime();
if ($STYLE == 0) {
printf "%02d:%02d:%02d %7s ",
$Time[2], $Time[1], $Time[0], $int;
print_neat($rkps);
print_neat($wkps);
print_neat($rpps);
print_neat($wpps);
print_neat($ravs);
print_neat($wavs);
printf "%7.2f %6.2f\n", $util, $sats;
}
elsif ($STYLE == 1) {
printf "%02d:%02d:%02d %8s %14.3f %14.3f\n",
$Time[2], $Time[1], $Time[0], $int, $rkps, $wkps;
}
$line++;
# for multiple interfaces, always print the header
$line += $PAGESIZE if @NetworkData > 1;
}
### Store old values
$NetworkDataOld{$int}
= "$rbytes:$wbytes:$rpackets:$wpackets:$sat:$time";
}
### Check for end
last if ++$loop == $loop_max;
### Interval
sleep $interval;
}
# find_nets - walk Kstat to discover network interfaces.
#
# This walks %Kstat and populates a %NetworkNames with discovered
# network interfaces.
#
sub find_nets {
my $found = 0;
### Loop over all Kstat modules
foreach my $module (keys %$Kstat) {
my $Modules = $Kstat->{$module};
foreach my $instance (keys %$Modules) {
my $Instances = $Modules->{$instance};
foreach my $name (keys %$Instances) {
### Skip interface if asked
if ($NETWORKONLY) {
next unless $NetworkOnly{$name};
}
### Skip if not the regular statistic set
next unless $name =~ /^$module/;
my $Names = $Instances->{$name};
# Check this is a network device.
# Matching on ifspeed has been more reliable than "class"
# we also match loopback interfaces.
if (defined $$Names{ifspeed} || $module eq "lo") {
### Save network interface
$NetworkNames{$name} = $Names;
$found++;
}
}
}
}
return $found;
}
# fetch - fetch Kstat data for the network interfaces.
#
# This uses the interfaces in %NetworkNames and returns useful Kstat data.
# The Kstat values used are rbytes64, obytes64, ipackets64, opackets64
# (or the 32 bit versions if the 64 bit values are not there).
#
sub fetch_net_data {
my ($rbytes, $wbytes, $rpackets, $wpackets, $speed, $time);
my @NetworkData = ();
$Kstat->update();
### Loop over previously found network interfaces
foreach my $name (keys %NetworkNames) {
my $Names = $NetworkNames{$name};
if (defined $$Names{opackets}) {
### Fetch write bytes
if (defined $$Names{obytes64}) {
$rbytes = $$Names{rbytes64};
$wbytes = $$Names{obytes64};
}
elsif (defined $$Names{obytes}) {
$rbytes = $$Names{rbytes};
$wbytes = $$Names{obytes};
} else {
$rbytes = $wbytes = 0;
}
### Fetch read bytes
if (defined $$Names{opackets64}) {
$rpackets = $$Names{ipackets64};
$wpackets = $$Names{opackets64};
}
else {
$rpackets = $$Names{ipackets};
$wpackets = $$Names{opackets};
}
### Fetch interface speed
if (defined $$Names{ifspeed}) {
$speed = $$Names{ifspeed};
}
else {
# if we can't fetch the speed, print the
# %Util as 0.0 . To do this we,
$speed = 2 ** 48;
}
### Determine saturation value
my $sat = 0;
if (defined $$Names{nocanput} or defined $$Names{norcvbuf}) {
$sat += defined $$Names{defer} ? $$Names{defer} : 0;
$sat += defined $$Names{nocanput} ? $$Names{nocanput} : 0;
$sat += defined $$Names{norcvbuf} ? $$Names{norcvbuf} : 0;
$sat += defined $$Names{noxmtbuf} ? $$Names{noxmtbuf} : 0;
}
### use the last snaptime value,
$time = $$Names{snaptime};
### store data
push @NetworkData, "$name:$rbytes:$wbytes:" .
"$rpackets:$wpackets:$speed:$sat:$time";
}
}
return @NetworkData;
}
# print_neat - print a float with decimal places if appropriate.
#
# This specifically keeps the width to 7 characters, if possible, plus
# a trailing space.
#
sub print_neat {
my $num = shift;
if ($num >= 100000) {
printf "%7d ", $num;
} elsif ($num >= 100) {
printf "%7.1f ", $num;
} else {
printf "%7.2f ", $num;
}
}
# usage - print usage and exit.
#
sub usage {
print STDERR <<END;
USAGE: nicstat [-hsz] [-i int[,int...]] | [interval [count]]
eg, nicstat # print summary since boot
nicstat 1 # print continually every 1 second
nicstat 1 5 # print 5 times, every 1 second
nicstat -s # summary output
nicstat -i hme0 # print hme0 only
END
exit 1;
}