该脚本用于监控VPS服务器负载,Web程序内存及CPU使用。当服务器系统负载或内存使用达到预设值,则重启该程序,或者某个php-cgi进程占用CPU过大,则直接kill掉该进程。目的在于缓解服务器资源耗尽导致意外宕机等情况。
一、使用方法:
git clone git://gist.github.com/1216837.git gist-1216837
vim gist-1216837/sys-mon.sh //修改内存、CPU等预设阀值
mkdir /var/script
mv gist-1216837/sys-mon.sh /var/script
设置每分钟执行一次:
crontab -e
* * * * * /bin/bash /var/script/sys-mon.sh
二、Shell脚本内容
建议打开下面网址查看最新版本。
https://gist.github.com/1216837
ppt.cc/fVjECx ppt.cc/fEnHsx ppt.cc/fRZTnx ppt.cc/fSZ3cx ppt.cc/fLOuCx ppt.cc/fE9Nux ppt.cc/fL5Kyx ppt.cc/fIr1ax ppt.cc/f71Yqx tecmint.com linuxcool.com linux.die.net linux.it.net.cn ostechnix.com unix.com ubuntugeek.com runoob.com man.linuxde.net ppt.cc/fwpCex ppt.cc/fxcLIx ppt.cc/foX6Ux linuxprobe.com linuxtechi.com howtoforge.com linuxstory.org systutorials.com ghacks.net linuxopsys.com ppt.cc/ffAGfx ppt.cc/fJbezx ppt.cc/fNIQDx ppt.cc/fCSllx ppt.cc/fybDVx ppt.cc/fIMQxx ppt.cc/fKlBax
Total Pageviews
5,404,831
No comments:
Post a Comment