2006. 8. 1. 14:14

관련사이트

2006. 8. 1. 14:12

Rsync서버백업

rsync -av --update --delete /usr/backup www.bsdian.com:/home/woosu_backup
2006. 8. 1. 14:12

Running Windows Applications On FreeBSD

2006. 8. 1. 14:11

MRTG For Postfix


NOTE:?This hack needs the File:?:Tail perl module by Matija Grabnar.
Download it from CPAN and install it first.
See 'man CPAN' for more info about installing CPAN modules.

DOWNLOAD

You need to download the following three scripts:

update-mailstats.pl
mailstats.pl
mrtg-mailstats.pl

save them all in /usr/local/bin and make them executable.

if you save them in a different directory then you will have to edit the
following line in mrtg-mailstats.pl:

$mailstats = "/usr/local/bin/mailstats.pl" ;

HOWTO


1. run the update-mailstats.pl program in the background like so:

update-mailstats.pl &

(you probably want to write a wrapper script to restart it in case it
ever gets killed.)

this updates a file called /tmp/stats.db (adjust to suit your needs)
with the inbound and outbound mail stats.

the logic of this script is extremely simple (and probably far from
perfect):

if the line contains "status=sent" then figure out the transport from
the "relay=" part of the line. if relay= contains "[" then assume it's
an IP address, and transport is smtp. otherwise, transport is whatever
the "relay=" bit says.

if line contains "smtpd.*client=" then we've received a message via
smtp. if line contains "pickup.*(sender|uid)=" then we've received a
message from a local user.

very simple, mostly works. i'm sure there are cases which it doesn't
catch. if you can improve it, let me know.

to tell the truth, it doesn't matter if it's 100% accurate or not.
the point is to give a pretty graph of some meaningless numbers to
management types. they love it :)



2. if you want to see the raw data, use the mailstats.pl script:

$ mailstats.pl
RECEIVED:?local 162
RECEIVED:?smtp 4253
SENT:?local 4101
SENT:?smtp 5118



3. add lines like the following to your mrtg.cfg:


#---------------------------------------------------------------#
# MRTG mail cfg: Postfix mailstats plotting with MRTG #
#---------------------------------------------------------------#
Target?postfix: /usr/local/bin/mrtg-mailstats.pl
Options?postfix: gauge, growright
Title?postfix: Postfix Statistics
?PageTop?postfix: <H1>Postfix Statistics</H1>
?WithPeak?postfix: dwmy
?YLegend?postfix: No. of messages
?ShortLegend?postfix: messages
?LegendI?postfix:  Incoming:
?LegendO?postfix:  Outgoing:
#---------------------------------------------------------------#

this runs the mrtg-mailstats.pl programs which totals the RECEIVED and
SENT lines output by mailstats.pl and then outputs it in a form
suitable for MRTG. it keeps the previous RECEIVED and SENT counts in
/tmp/mailstats.old


위와 같이 하면 성공.

update-mailstats.pl & 을 실행했을때, 아래와 같은 에러 메세지를 출력한다면,
Can't locate File/Tail.pm in @INC.....


# wget http://search.cpan.org/CPAN/authors/id/M/MG/MGRABNAR/File-Tail-0.98.tar.gz# tar xvfz File-Tail-0.98.tar.gz# cd File-Tail-0.98# perl Makefile.PL# make# make test# make install하여, File-Tail을 설치를 해준다...
2006. 8. 1. 14:11

포트설치시Ftp.kr.freebsd.org부터찾기

일반적으로 포트에서 패키지 설치시 해당 소스를 각각의 서버로부터 받아옵니다. 많이 느리죠.
그런데 ftp.kr.freebsd.org/pub/FreeBSD/ports/distfiles/*
디렉토리에 대부분의 소스를 미러링해주고 있습니다.

패키지 설치시 우선적으로 로컬을 검색하고 이후 ftp.kr.freebsd.org를 검색하고 없을 경우 각각의 프로젝트 서버로 접속하게끔 해주기 위해서
/etc/make.conf 파일에 다음의 내용을 추가합니다.

코드:

MASTER_SITE_BACKUP?=ftp://ftp.kr.FreeBSD.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}/ MASTER_SITE_OVERRIDE?=${MASTER_SITE_BACKUP}