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 次;
作者添加了以下标签: shell,hard disk space;
首页只显示了部分日志内容,要查看日志的全部内容请阅读全文;
- #!/bin/bash
- #
- # Script to notify admin user if Linux,FreeBSD load crossed certain limit
- # It will send an email notification to admin.
- #
- # Copyright 2005 (c) nixCraft project
- # This is free script under GNU GPL version 2.0 or above.
- # Support/FeedBack/comment : http://cyberciti.biz/fb/
- # Tested os:
- # * RedHat Linux
- # * Debain Linux
- # * FreeBSD
- # -------------------------------------------------------------------------
- # This script is part of nixCraft shell script collection (NSSC)
- # Visit http://bash.cyberciti.biz/ for more information.
- # -------------------------------------------------------------------------
- # Set up limit below
- NOTIFY="6.0"
- # admin user email id
- EMAIL="root"
- # Subject for email
- SUBJECT="Alert $(hostname) load average"
- # -----------------------------------------------------------------
- # Os Specifc tweaks do not change anything below ;)
- OS="$(uname)"
- TRUE="1"
- if [ "$OS" == "FreeBSD" ]; then
- TEMPFILE="$(mktemp /tmp/$(basename $0).tmp.XXX)"
- FTEXT='load averages:'
- elif [ "$OS" == "Linux" ]; then
- TEMPFILE="$(mktemp)"
- FTEXT='load average:'
- fi
- # get first 5 min load
- F5M="$(uptime | awk -F "$FTEXT" '{ print $2 }' | cut -d, -f1) | sed 's/ //g'"
- # 10 min
- F10M="$(uptime | awk -F "$FTEXT" '{ print $2 }' | cut -d, -f2) | sed 's/ //g'"
- # 15 min
- F15M="$(uptime | awk -F "$FTEXT" '{ print $2 }' | cut -d, -f3) | sed 's/ //g'"
- # mail message
- # keep it short coz we may send it to page or as an short message (SMS)
- echo "Load average Crossed allowed limit $NOTIFY." >> $TEMPFILE
- echo "Hostname: $(hostname)" >> $TEMPFILE
- echo "Local Date & Time : $(date)" >> $TEMPFILE
- # Look if it crossed limit
- # compare it with last 15 min load average
- RESULT=$(echo "$F15M > $NOTIFY" | bc)
- # if so send an email
- if [ "$RESULT" == "$TRUE" ]; then
- mail -s "$SUBJECT" "$EMAIL" < $TEMPFILE
- fi
- # remove file
- rm -f $TEMPFILE
本日志由 flyinweb 于 2009-12-23 12:49:03 发表到 Linux 中,目前已经被浏览 66 次,评论 0 次;
作者添加了以下标签: Shell,System Load;
症状:
在脚本进行FTP远程数据传输时,老是出现如下错误:ftp: bind: Address already in use
本日志由 flyinweb 于 2009-12-17 11:58:16 发表到 Linux 中,目前已经被浏览 189 次,评论 0 次;
作者添加了以下标签: Address already in use;
首页只显示了部分日志内容,要查看日志的全部内容请阅读全文;
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 Memory,VM;
首页只显示了部分日志内容,要查看日志的全部内容请阅读全文;
=========================================
常见 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 使用差异 ?
环境:
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配置文件
- <IfModule mod_fcgid.c>
- AddHandler fcgid-script .fcgi
- IPCConnectTimeout 20
- MaxProcessCount 5
- DefaultMaxClassProcessCount 2
- DefaultMinClassProcessCount 1
- </IfModule>
增加MaxProcessCount 参数值
本日志由 flyinweb 于 2009-12-01 15:17:46 发表到 Linux 中,目前已经被浏览 110 次,评论 0 次;
作者添加了以下标签: MaxProcessCount,fcgid;
首页只显示了部分日志内容,要查看日志的全部内容请阅读全文;
vllddaee: vllddaee...
根据inotify + rsync的思路,现在有了个c++版本的同步程序,只需指
真是有耐心呀。我做了个pdf 文件 在上面的网站可以下载