2007/11/27 21:56
批量删除某目录下2天没有访问的文件。
cd /home/hx/test
find . -type f -atime +2 -exec rm -f {} \;
其中-atime +2 表示2天没有访问,-atime -2表示最近2天有访问过的。
除atime外,还有amin,分钟,
find / -mmin -5 # 查找在系统中最后5分钟里修改过的文件
find / -mtime -1 #查找在系统中最后24小时里修改过的文件
具体参见:Find命令详解和linux 常用命令汇总
来自hightman的
netstat -an | grep -v LISTEN | awk '{print $5}' | awk 'BEGIN { FS=":" } { Num[$1]++ } END { for(i in Num) if(Num[i]>8) { print i} }' | xargs -i[] iptables -I INPUT -s [] -j DROP
红色部分为设定值,这条句子会自动将netstat -an 中查到的来自同一IP的超过一定量的连接的列入禁止范围,红色部分为阀值.
cd /home/hx/test
find . -type f -atime +2 -exec rm -f {} \;
其中-atime +2 表示2天没有访问,-atime -2表示最近2天有访问过的。
除atime外,还有amin,分钟,
find / -mmin -5 # 查找在系统中最后5分钟里修改过的文件
find / -mtime -1 #查找在系统中最后24小时里修改过的文件
具体参见:Find命令详解和linux 常用命令汇总
来自hightman的
netstat -an | grep -v LISTEN | awk '{print $5}' | awk 'BEGIN { FS=":" } { Num[$1]++ } END { for(i in Num) if(Num[i]>8) { print i} }' | xargs -i[] iptables -I INPUT -s [] -j DROP
红色部分为设定值,这条句子会自动将netstat -an 中查到的来自同一IP的超过一定量的连接的列入禁止范围,红色部分为阀值.
2007/10/24 16:43
httpd: Syntax error on line 266 of /usr/local/apache2.2.0/conf/httpd.conf: module deflate_module is built-in and can't be loaded
- 表示模块已内置,不必LoadModule了
tar.bz2的文件怎么解压缩?
- 在linux下面可以直接用 tar jxvf *.tar.bz2解压缩
- 先去digistar.com/bzip2/下个bzip回来. 装上后 ,用 bzip2 -cd ***就可以解了.
mod_deflate.c在modules/metadata下没找到它,后来发现在modules/filters下
/usr/local/apache2.2.0/bin/apxs -i -a -c mod_deflate.c
提示出错:
Warning! dlname not found in /usr/local/apache2.2.0/modules/mod_deflate.la.
Assuming installing a .so rather than a libtool archive.
chmod 755 /usr/local/apache2.2.0/modules/mod_deflate.so
后来使用这种方式解决:
gcc -shared -o mod_deflate.so mod_deflate.o
cp mod_deflate.so /usr/local/apache2.2.0/modules
/usr/local/apache2.2.0/bin/apxs -i -a -c mod_deflate.c
- 表示模块已内置,不必LoadModule了
tar.bz2的文件怎么解压缩?
- 在linux下面可以直接用 tar jxvf *.tar.bz2解压缩
- 先去digistar.com/bzip2/下个bzip回来. 装上后 ,用 bzip2 -cd ***就可以解了.
mod_deflate.c在modules/metadata下没找到它,后来发现在modules/filters下
/usr/local/apache2.2.0/bin/apxs -i -a -c mod_deflate.c
提示出错:
Warning! dlname not found in /usr/local/apache2.2.0/modules/mod_deflate.la.
Assuming installing a .so rather than a libtool archive.
chmod 755 /usr/local/apache2.2.0/modules/mod_deflate.so
后来使用这种方式解决:
gcc -shared -o mod_deflate.so mod_deflate.o
cp mod_deflate.so /usr/local/apache2.2.0/modules
/usr/local/apache2.2.0/bin/apxs -i -a -c mod_deflate.c
2007/10/22 10:28
前段时间才知道eAccelerator的,是看一个程序的源代码时,发现里面有eaccelerator_load('一大堆字符串'); 搜索了一下,才知道是PHP平台预编译加速的一个方法,有点同ZendOptimizer,即能编译加速又能加密源代码。
今天在机子上测试安装它,试用,安装很顺利,记录一下。
官方网站:http://eaccelerator.net/
从其网站上下载了最新版,eaccelerator-0.9.5.2。根据很详细的安装说明:http://eaccelerator.net/wiki/InstallFromSource进行安装。
下载
wget http://bart.eaccelerator.net/source/0.9.5.2/eaccelerator-0.9.5.2.zip
解压
unzip eaccelerator-0.9.5.2.zip
切换到其目录
cd eaccelerator-0.9.5.2
开始安装
export PHP_PREFIX="/usr/local/php4.4.0"
$PHP_PREFIX/bin/phpize
./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config
make;make install
最后提示了一个目录:/usr/local/php4.4.0/lib/php/extensions/no-debug-non-zts-20020429/
在php.ini中加入:
zend_extension="/usr/local/php4.4.0/lib/php/extensions/no-debug-non-zts-20020429/eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
和官方说明唯一不同的就是更改了zend_extension的路径。
然后:
mkdir /tmp/eaccelerator
chmod 0777 /tmp/eaccelerator
重启Apache,看了下phpinfo()
This program makes use of the Zend Scripting Language Engine:
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies with eAccelerator v0.9.5.2, Copyright (c) 2004-2006 eAccelerator, by eAccelerator
安装顺利完成。
相关文章:
eAccelerator README for Linux 简体中文翻译:http://www.itlearner.com/article/2007/3895.shtml
给PHP加速,eAccelerator配置和使用指南:http://www.toplee.com/blog/?p=100
eAccelerator的安装和性能比较:http://www.chedong.com/blog/archives/001154.html
UPDATE@@071024
看官方说明,了解到,可以使用php -v来查看这段信息,无需重启Apache。而且,如果配置错误,还会有相应提示。
在正式服务器上安装,在php.ini加参数时,第一行直接使用zend_extension=,没有效果
使用extension= ,提示PHP Warning: PHP Startup: Unable to load dynamic library './/usr/local/php5/lib/php/extensions/no-debug-zts-20050922/eaccelerator.so' - .//usr/local/php5/lib/php/extensions/no-debug-zts-20050922/eaccelerator.so: cannot open shared object file: No such file or directory in Unknown on line 0
后来用zend_extension_ts = ,就可以了。
官方说明:If you use a thread safe build of PHP you must use "zend_extension_ts" instead of "zend_extension".
# /usr/local/php5/bin/php -v
PHP 5.1.6 (cli) (built: Feb 7 2007 11:06:51)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
with eAccelerator v0.9.5.2, Copyright (c) 2004-2006 eAccelerator, by eAccelerator
今天在机子上测试安装它,试用,安装很顺利,记录一下。
官方网站:http://eaccelerator.net/
从其网站上下载了最新版,eaccelerator-0.9.5.2。根据很详细的安装说明:http://eaccelerator.net/wiki/InstallFromSource进行安装。
下载
wget http://bart.eaccelerator.net/source/0.9.5.2/eaccelerator-0.9.5.2.zip
解压
unzip eaccelerator-0.9.5.2.zip
切换到其目录
cd eaccelerator-0.9.5.2
开始安装
export PHP_PREFIX="/usr/local/php4.4.0"
$PHP_PREFIX/bin/phpize
./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config
make;make install
最后提示了一个目录:/usr/local/php4.4.0/lib/php/extensions/no-debug-non-zts-20020429/
在php.ini中加入:
zend_extension="/usr/local/php4.4.0/lib/php/extensions/no-debug-non-zts-20020429/eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
和官方说明唯一不同的就是更改了zend_extension的路径。
然后:
mkdir /tmp/eaccelerator
chmod 0777 /tmp/eaccelerator
重启Apache,看了下phpinfo()
This program makes use of the Zend Scripting Language Engine:
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies with eAccelerator v0.9.5.2, Copyright (c) 2004-2006 eAccelerator, by eAccelerator
安装顺利完成。
相关文章:
eAccelerator README for Linux 简体中文翻译:http://www.itlearner.com/article/2007/3895.shtml
给PHP加速,eAccelerator配置和使用指南:http://www.toplee.com/blog/?p=100
eAccelerator的安装和性能比较:http://www.chedong.com/blog/archives/001154.html
UPDATE@@071024
看官方说明,了解到,可以使用php -v来查看这段信息,无需重启Apache。而且,如果配置错误,还会有相应提示。
在正式服务器上安装,在php.ini加参数时,第一行直接使用zend_extension=,没有效果
使用extension= ,提示PHP Warning: PHP Startup: Unable to load dynamic library './/usr/local/php5/lib/php/extensions/no-debug-zts-20050922/eaccelerator.so' - .//usr/local/php5/lib/php/extensions/no-debug-zts-20050922/eaccelerator.so: cannot open shared object file: No such file or directory in Unknown on line 0
后来用zend_extension_ts = ,就可以了。
官方说明:If you use a thread safe build of PHP you must use "zend_extension_ts" instead of "zend_extension".
# /usr/local/php5/bin/php -v
PHP 5.1.6 (cli) (built: Feb 7 2007 11:06:51)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
with eAccelerator v0.9.5.2, Copyright (c) 2004-2006 eAccelerator, by eAccelerator
2007/10/19 15:07
今天连接网站FTP时,连不上,提示如下信息,然后就停住了。
上服务器看下,服务正常。停掉,重启了一下,也不行。
过了很长一段时间的查找原因,终于发现,在配置文件中,DefaultServer 被设置成 off 了。可能是被网管改的。改成 on,停掉,重启,连接FTP就正常了:)
参考资料:http://www.proftpd.org/docs/directives/linked/config_ref_DefaultServer.html
引用
状态:> Socket 已连接。正在等候欢迎消息...
500 Sorry, no server available to handle request on xxx.xxx.xxx.xxx
错误:> 语法错误,命令未确认。
500 Sorry, no server available to handle request on xxx.xxx.xxx.xxx
错误:> 语法错误,命令未确认。
上服务器看下,服务正常。停掉,重启了一下,也不行。
过了很长一段时间的查找原因,终于发现,在配置文件中,DefaultServer 被设置成 off 了。可能是被网管改的。改成 on,停掉,重启,连接FTP就正常了:)
参考资料:http://www.proftpd.org/docs/directives/linked/config_ref_DefaultServer.html
2007/10/17 19:38
同事一个站在查询时,提示:无法打开此文件。程序是生成一个文件夹,然后读取这个文件夹的内容。以前都可以生成的,上服务器看了下,有777的权限。
于是直接在命令行下,mkdir test
结果提示:
mkdir: cannot create directory `test`: Too many links
我看了一下,那个目录下有狂多的目录,猜想是不是Linux也有目录限制。记得Windows是有的,以前就碰到过。
搜索了一下,原来是有32000的限制。
原程序是每查询一个,就生成一个目录,怪不得有这么多目录。于是建议他以dir/dir或dir/dir/dir的形式存储,问题解决:)
另外,同一个目录下的文件不要太多,听说超过1000个文件或目录时读取速度就有些影响了。
于是直接在命令行下,mkdir test
结果提示:
mkdir: cannot create directory `test`: Too many links
我看了一下,那个目录下有狂多的目录,猜想是不是Linux也有目录限制。记得Windows是有的,以前就碰到过。
搜索了一下,原来是有32000的限制。
引用
I already talked to Drew, there is a limit of 32,000 links in an inode,
which in turn limits the number of directories in a single place to 31,998
There is no way to increase this in ext2 without changing the inode format,
which will not happen before a little while (dixit the major ext2 FS guys at
ALS)
Solutions:
1) use base/d/di/directoryname name splits
2) use another filesystem (note that the default filesystem on freebsd, and
probably many other FS do also have a limit of 32K directories or
somesuch, so for portability, you want solution #1)
Marc
来源:http://blog.51766.com/page/zsc?entry=1141036876883
which in turn limits the number of directories in a single place to 31,998
There is no way to increase this in ext2 without changing the inode format,
which will not happen before a little while (dixit the major ext2 FS guys at
ALS)
Solutions:
1) use base/d/di/directoryname name splits
2) use another filesystem (note that the default filesystem on freebsd, and
probably many other FS do also have a limit of 32K directories or
somesuch, so for portability, you want solution #1)
Marc
来源:http://blog.51766.com/page/zsc?entry=1141036876883
原程序是每查询一个,就生成一个目录,怪不得有这么多目录。于是建议他以dir/dir或dir/dir/dir的形式存储,问题解决:)
另外,同一个目录下的文件不要太多,听说超过1000个文件或目录时读取速度就有些影响了。







