Archive for FreeBSD
2007-06-28 @ 12:49:57 · Filed under CentOS, FreeBSD, Ubuntu
find命令功能其实很强,针对某些特定条件的日志文件特别有效,下面列举几个技巧:
1.查找90天以前的文件,并用LS列出全名
# find /data/webdata -mtime +90 -type f -exec ls -l -h {} \;
2.查找修改时间超过90天的文件
# find /data/webdata -mtime +90
3.查找修改时间超过90天,并且不包含click_15和click_16目录的文件
# find /data/webdata -mtime +90 \( -path /data/webdata/click_15 -o -path /data/webdata/click_16 \) -prune -o -print
4.查找修改时间超过90天,并需确认删除
# find /data/webdata -mtime +90 -ok rm -R {} \;
2007-06-25 @ 13:09:50 · Filed under CentOS, FreeBSD, SQLite, Ubuntu
很简单的一条命令:
sqlite2 mydb.db .dump | sqlite3 mydb-new.db
如果需要很多数据库,写个简单的脚本即可。
#!/bin/bash
#
# description: Upgrade SQLite2 to SQLite3
#
DBPATH="/data/db"
for oldfile in $(find ${DBPATH} -name "*.db"); do
newfile="${oldfile}.bak"
sqlite2 $oldfile .dump | sqlite3 $newfile
mv -f $newfile $oldfile
echo $newfile
echo $oldfile
2007-06-25 @ 12:45:48 · Filed under CentOS, FreeBSD, General, MySQL, Ubuntu
实际上这种文章已经很多了,网上也到处都是,之所以写这篇文章,目的是为了解决其中一个问题。
# cd /usr/local/src
# wget http://cn.php.net/distributions/php-5.2.3.tar.gz
# tar -zxvf php-5.2.3.tar.gz
# cd php-5.2.3
# ./configure --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --target=x86_64-redhat-linux-gnu --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --cache-file=../config.cache --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --enable-force-cgi-redirect --disable-debug --enable-pic --disable-rpath --enable-inline-optimization --with-exec-dir=/usr/bin --with-freetype-dir --with-png-dir=/usr/local --with-gd=shared --enable-gd-native-ttf --with-iconv --with-jpeg-dir=/usr/local --with-openssl --with-png --with-pcre-regex --with-zlib --with-layout=GNU --enable-magic-quotes --enable-sockets --enable-sysvsem --enable-sysvshm --enable-track-vars --enable-trans-sid --enable-memory-limit --enable-shmop --with-mime-magic=/usr/share/file/magic.mime --with-apxs2=/usr/sbin/apxs --with-sqlite --with-pdo-sqlite --without-pear --disable-xmlwriter --disable-xmlreader --disable-xml --disable-simplexml --disable-libxml --disable-dom --disable-ipv6 --disable-json --disable-hash --with-mysql --with-pdo-mysql
很多人在执行到这一步的时候,会出现以下问题:
Read more…
2006-08-26 @ 14:54:57 · Filed under Apache, FreeBSD, Lighttpd
查看FIN_WAIT_2连接数:
bsd#netstat -an | grep FIN_WAIT_2 | wc -l
2523
修改Lighttpd配置文件,加入下面这条语句:
server.max-keep-alive-requests = 0
bsd#netstat -an | grep FIN_WAIT_2 | wc -l
91
如果服务器开启了ipfw2防火墙的话,还需要执行:
sysctl -w net.inet.ip.fw.dyn_keepalive=0
p.s. 若为APACHE服务器,同理。