这几天在学习研究shell脚本,写的一些系统负载与CPU监控脚本程序。在没有nagios监控软件的情况下,只要服务器能上互联网,就可通过发邮件的方式来提醒管理员系统负载与CPU占用的使用情况。一、安装linux下面的一个邮件客户端msmtp软件(类似于一个foxmail的工具) 1、下载安装: http://downloads.sourceforge.net/msmtp/msm
#!/bin/bashj=0for i in `seq 10`do a=`expr $i % 2` if [ $a -eq 0 ]; then echo $i else let j++ fidoneecho $j
* 此脚本最多适合一个C段的IP* 此脚本自带安装、修复、添加用户功能* 此脚本适合Centos 6 版本#!/bin/bashfunction installVPN(){ echo "begin to install VPN services"; #check wether vps sup
说明:此脚本适合centos 5.5系统,最多4个C段IP,IP对应的帐号密码保存在/etc/ippasswd.txt里。#!/bin/bashi=0echo -e "#####\033[32m Please note this shell only fit Centos 5.5 and the maxcount is 1012\\033[0m#####"read -p "Do you under
#vi /etc/init.d/apached#!/bin/bash #chkconfig: - 85 15#description: Apache is a Web server APA=/usr/local/httpd2/bin/apachectlNET=$(netstat -antpu | grep :80)start(){ i
#vi /etc/init.d/haproxy!/bin/bash#chkconfig:- 85 15 #-:表示所有级别,85:表示启动顺序,15:关闭顺序#description:haproxy serverHA_PAT=/usr/local/haproxyHA_
站群服务器有很多IP地址,如果手动配置,需要很多时间。用shell脚本来实现自动配置能有效提高工作效率。如下:先给服务器配置好第一个IP,然后ssh登录服务器;在/root下创建文件iprange.txt,并将IP段写入iprange.txt;如下#cat iprange.txt 192.168.10.0/28 192.168.10.16/28 192.168.20.
检查mysql主从同步结构(一主一从)中的从数据库服务器的状态 (ip授权、从服务器和IO是否正常、从mysql进程是否正常)主mysql: 192.168.1.10从mysql: 192.168.1.20[root@ser2 ~]# vi check_slave.sh#!/bin/bashmaster=192.168.1.10i=
Copyright © 2005-2025 51CTO.COM 版权所有 京ICP证060544号