一般我们把rsync放在crontab里进行定时文件同步,同步的延时有可能会比我们想象的长。这里你可以使用inotify来对文件进行监控,实现触发式同步。

本日志由 flyinweb 于 2009-12-25 10:05:57 发表到 Linux 中,目前已经被浏览 166 次,评论 1 次;

作者添加了以下标签: inotifyrsync文件同步

首页只显示了部分日志内容,要查看日志的全部内容请阅读全文

The below script will check the hard disk space usage, using the command du and send an email alert if any of the partition is using more than 85% of space.

本日志由 flyinweb 于 2009-12-23 12:52:10 发表到 Linux 中,目前已经被浏览 83 次,评论 0 次;

作者添加了以下标签: shellhard disk space

首页只显示了部分日志内容,要查看日志的全部内容请阅读全文

  1. #!/bin/bash  
  2. #  
  3. # Script to notify admin user if Linux,FreeBSD load crossed certain limit  
  4. # It will send an email notification to admin.  
  5. #  
  6. # Copyright 2005 (c) nixCraft project  
  7. # This is free script under GNU GPL version 2.0 or above.  
  8. # Support/FeedBack/comment :  http://cyberciti.biz/fb/  
  9. # Tested os:  
  10. # * RedHat Linux  
  11. # * Debain Linux  
  12. # * FreeBSD  
  13. # -------------------------------------------------------------------------  
  14. # This script is part of nixCraft shell script collection (NSSC)  
  15. # Visit http://bash.cyberciti.biz/ for more information.  
  16. # -------------------------------------------------------------------------  
  17.    
  18. # Set up limit below  
  19. NOTIFY="6.0"  
  20.    
  21. # admin user email id  
  22. EMAIL="root"  
  23.    
  24. # Subject for email  
  25. SUBJECT="Alert $(hostname) load average"  
  26.    
  27. # -----------------------------------------------------------------  
  28.    
  29. # Os Specifc tweaks do not change anything below ;)  
  30. OS="$(uname)"  
  31. TRUE="1"  
  32. if [ "$OS" == "FreeBSD" ]; then  
  33.         TEMPFILE="$(mktemp /tmp/$(basename $0).tmp.XXX)"  
  34.     FTEXT='load averages:'  
  35. elif [ "$OS" == "Linux" ]; then  
  36.         TEMPFILE="$(mktemp)"  
  37.     FTEXT='load average:'  
  38. fi  
  39.    
  40. # get first 5 min load  
  41. F5M="$(uptime | awk -F "$FTEXT" '{ print $2 }' | cut -d, -f1) | sed 's/ //g'"  
  42. # 10 min  
  43. F10M="$(uptime | awk -F "$FTEXT" '{ print $2 }' | cut -d, -f2) | sed 's/ //g'"  
  44. # 15 min  
  45. F15M="$(uptime | awk -F "$FTEXT" '{ print $2 }' | cut -d, -f3) | sed 's/ //g'"  
  46.    
  47. # mail message  
  48. # keep it short coz we may send it to page or as an short message (SMS)  
  49. echo "Load average Crossed allowed limit $NOTIFY." >> $TEMPFILE  
  50. echo "Hostname: $(hostname)" >> $TEMPFILE  
  51. echo "Local Date & Time : $(date)" >> $TEMPFILE  
  52.    
  53. # Look if it crossed limit  
  54. # compare it with last 15 min load average  
  55. RESULT=$(echo "$F15M > $NOTIFY" | bc)  
  56.    
  57. # if so send an email  
  58. if [ "$RESULT" == "$TRUE" ]; then  
  59.         mail -s "$SUBJECT" "$EMAIL" < $TEMPFILE  
  60. fi  
  61.    
  62. # remove file  
  63. rm -f $TEMPFILE 

本日志由 flyinweb 于 2009-12-23 12:49:03 发表到 Linux 中,目前已经被浏览 66 次,评论 0 次;

作者添加了以下标签: ShellSystem Load

症状:

在脚本进行FTP远程数据传输时,老是出现如下错误:ftp: bind: Address already in use

本日志由 flyinweb 于 2009-12-17 11:58:16 发表到 Linux 中,目前已经被浏览 189 次,评论 0 次;

作者添加了以下标签: Address already in use

首页只显示了部分日志内容,要查看日志的全部内容请阅读全文

  在linux下,我们可以通过自带的NTP(Network Time Protocol)协议通过网络使自己的系统保持精确的时间。可用的公共时间服务器列表可以从下面的地址获取:

  http://ntp.isc.org/bin/view/Servers/NTPPoolServers

  NTP是用来使系统和一个精确的时间源保持时间同步的协议。建议大家在自己管理的网络中建立至少一台时间服务器来同步本地时间,这样可以使得在不同的系统上处理和收集日志和管理更加容易。

本日志由 flyinweb 于 2009-12-10 11:45:49 发表到 Linux 中,目前已经被浏览 115 次,评论 0 次;

作者添加了以下标签: 时间服务器ntpdntpdate

首页只显示了部分日志内容,要查看日志的全部内容请阅读全文

Understanding Virtual Memory

Introduction

One of the most important aspects of an operating system is the Virtual Memory Management system. Virtual Memory (VM) allows an operating system to perform many of its advanced functions, such as process isolation, file caching, and swapping. As such, it is imperative that an administrator understand the functions and tunable parameters of an operating system's Virtual Memory Manager so that optimal performance for a given workload may be achieved. After reading this article, the reader should have a rudimentary understanding of the data the Red Hat Enterprise Linux (RHEL3) VM controls and the algorithms it uses. Further, the reader should have a fairly good understanding of general Linux VM tuning techniques. It is important to note that Linux as an operating system has a proud legacy of overhaul. Items which no longer serve useful purposes or which have better implementations as technology advances are phased out. This implies that the tuning parameters described in this article may be out of date if you are using a newer or older kernel. Fear not however! With a well grounded understanding of the general mechanics of a VM, it is fairly easy to convert knowledge of VM tuning to another VM. The same general principles apply, and documentation for a given kernel (including its specific tunable parameters) can be found in the corresponding kernel source tree under the file Documentation/sysctl/vm.txt.

本日志由 flyinweb 于 2009-12-08 17:51:10 发表到 Linux 中,目前已经被浏览 95 次,评论 0 次;

作者添加了以下标签: Virtual MemoryVM

首页只显示了部分日志内容,要查看日志的全部内容请阅读全文

=========================================
常见 iptables 的 firewall 设定配置问题
作者: 小州 (kenduest)
=========================================

一、标题列表项目:  (一般本机的 firewall 配置问题)

1. 如何查询我目前 iptables 的配置组态设定 ?
2. 如何关闭 Linux Distro 本身的 firewall 配置并让规则清空不启用?
3. 关于 RedHat 9, Fedora 与 RHEL 的 firewall 配置问题
4. 如何使用手动方式清空与重置 iptables firewall rule?
5. iptables firewall 本身封包比对判断流程图为何?
6. iptables firewall 本身封包比对规则方式为何?
7. 使用 -P INPUT DROP 引起的主機本身對外連線不通问题?
8. 使用 -P INPUT DROP 导致本机存取自己服务也受到限制?
9. 使用 -P INPUT DROP 引起的网路存取正常,但是 ftp 连入却失败?
10. 使用 -P OUTPUT DROP 引起的网路不通问题?
11. 有无建议本机 firewall 服务只有开放对外项目,其余禁止的配置方式?

二、标题列表项目:  (提供 NAT 服务配置问题)

1. 一般建议单纯化的 NAT 服务配置语法为何?
2. 透过 NAT 上网的内部 ip 主机,ftp 连结存取错误?
3. 如何配置连线到 NAT 主机某个对外 Port 时,可以转送到内部某主机?
4. 使用 -j MASQUERADE 与 -j SNAT 于 NAT 使用差异 ?

本日志由 flyinweb 于 2009-12-08 14:43:58 发表到 Linux 中,目前已经被浏览 93 次,评论 0 次;

作者添加了以下标签: iptablesmodprobeip_conntrack_ftp

首页只显示了部分日志内容,要查看日志的全部内容请阅读全文

环境:

LAMP PHP(FastCGI )

症状:

[Tue Dec 01 10:19:21 2009] [notice] mod_fcgid: /var/www/vhosts/xiangbaozhongxin.com/httpdocs/shopadmin/index.php total process count 65 >= 64, skip the spawn  request
[Tue Dec 01 10:19:21 2009] [notice] mod_fcgid: /var/www/vhosts/xiangbaozhongxin.com/httpdocs/shopadmin/index.php total process count 65 >= 64, skip the spawn  request

解决办法:

查找mod_fcgid配置文件

  1. <IfModule mod_fcgid.c> 
  2.   AddHandler    fcgid-script .fcgi  
  3.   IPCConnectTimeout 20  
  4.   MaxProcessCount 5  
  5.   DefaultMaxClassProcessCount 2  
  6.   DefaultMinClassProcessCount 1  
  7. </IfModule> 

增加MaxProcessCount 参数值

本日志由 flyinweb 于 2009-12-01 15:17:46 发表到 Linux 中,目前已经被浏览 110 次,评论 0 次;

作者添加了以下标签: MaxProcessCountfcgid

首页只显示了部分日志内容,要查看日志的全部内容请阅读全文

1471/19