linux-shell系列5-统计
#!/bin/bash
show=$(service --status-all 2>/dev/null | grep -E "is running|正在运行"|awk '{print $1}'|grep -E "tingyun-agent-system|httpd|nginx|redis|*ftp*|php-fpm|mongod")
for i in $show
do
if [ $i == "nginx" ];then echo "$i 服务器web应用";fi
if [ $i = "redis-server" ];then echo "$i 服务器缓存应用";fi
if [ $i = "vsftpd" ];then echo "$i 服务器ftp应用";fi
if [ $i = "php-fpm" ];then echo "$i 服务器php应用";fi
if [ $i = "httpd" ];then echo "$i 服务器web应用";fi
if [ $i = "mongod" ];then echo "$i 服务器数据库应用";fi
if [ $i = "tingyun-agent-system" ];then echo "$i 听云探针应用";fi
done
ps=$(ps aux|grep mysqld|awk '{print $1}')
for i in $ps
do
if [ $i == "mysql" ];then echo "$i 服务器web应用";fi
done
sl=$(ps aux |grep -v grep|grep tomcat|grep solr|awk '{print $NF}')
[ ! -n $sl ] && echo "java 服务器java-solr应用"
fpm=$(ps aux |grep -v grep|grep php-fpm|awk '{print $1}'|sed -n '1p')
[ ! -n $fpm ] && echo "php-fpm 服务器web应用"
df -hP|sed -n '2p'|awk '{print "系统盘容量总计:"$2 " " "已使用容量:"$3}'
diskdata=$(df -TP | sed '1d' | awk '$2!="tmpfs"{print}')
disktotal=$(echo "$diskdata" | awk '{total+=$3}END{print total}')
diskused=$(echo "$diskdata" | awk '{total+=$4}END{print total}')
sysdata=$(df -TP | sed -n '2p' | awk '{print $3}')
sysused=$(df -TP | sed -n '2p' | awk '{print $4}')
datatotal=$((disktotal-sysdata))
dataused=$((diskused-$sysused))
echo "数据盘容量总计:$((datatotal/1024/1024))G 已使用容量:$((dataused/1024/1024))G"
linux-shell系列5-统计的更多相关文章
- linux shell系列9 统计用户的权限
#!/bin/bash #set -x host=`hostname` ip=`ifconfig $(ip a|grep eth|head -n1|awk -F: '{print $2}') |gre ...
- Linux Shell系列教程之(十七) Shell文件包含
本文是Linux Shell系列教程的第(十七)篇,更多Linux Shell教程请看:Linux Shell系列教程 通过文件包含,可以引用其他文件的内容,也可以将复杂内容分开,使程序结构更加清晰. ...
- Linux Shell系列教程之(十六) Shell输入输出重定向
本文是Linux Shell系列教程的第(十六)篇,更多Linux Shell教程请看:Linux Shell系列教程 Shell中的输出和输入的重定向是在使用中经常用到的一个功能,非常实用,今天就为 ...
- Linux Shell系列教程之(十五) Shell函数简介
本文是Linux Shell系列教程的第(十五)篇,更多Linux Shell教程请看:Linux Shell系列教程 函数可以将一个复杂功能划分成若干模块,从而使程序结构更加清晰,代码重复利用率更高 ...
- Linux Shell系列教程之(十四) Shell Select教程
本文是Linux Shell系列教程的第(十四)篇,更多Linux Shell教程请看:Linux Shell系列教程 在上一篇文章:Linux Shell系列教程之(十三)Shell分支语句case ...
- Linux Shell系列教程之(十三)Shell分支语句case … esac教程
本文是Linux Shell系列教程的第(十三)篇,更多Linux Shell教程请看:Linux Shell系列教程 分支语句非常实用,基本上高级语言都支持分支语句(python 没有),大多数都使 ...
- Linux Shell系列教程之(十二)Shell until循环
本文是Linux Shell系列教程的第(十二)篇,更多Linux Shell教程请看:Linux Shell系列教程 在上两篇文章Linux Shell系列教程之(十)Shell for循环和Lin ...
- (转)Linux Shell系列教程之(十四) Shell Select教程
本文属于<Linux Shell 系列教程>文章系列,该系列共包括以下 18 部分: Linux Shell系列教程之(一)Shell简介 Linux Shell系列教程之(二)第一个Sh ...
- Linux Shell系列教程
学习Linux Shell知识,就来Linux大学网(Linuxdaxue.com)! 本系列适合Linux初学者,属于Linux入门级教程,主要介绍了Shell的分类.语法格式以及脚本的使用和编写格 ...
- Linux Shell系列教程之(十一)Shell while循环
本文是Linux Shell系列教程的第(十一)篇,更多Linux Shell教程请看:Linux Shell系列教程 在上一篇Linux Shell系列教程之(十)Shell for循环中,我们已经 ...
随机推荐
- xxtea---单片机数据加密算法
转:https://www.cnblogs.com/LittleTiger/p/4384741.html 各位大侠在做数据传输时,有没有考虑过把数据加密起来进行传输,若在串口或者无线中把所要传的数据加 ...
- .NET-记一次架构优化实战与方案-梳理篇
目录 .NET-记一次架构优化实战与方案-梳理篇 .NET-记一次架构优化实战与方案-前端优化 .NET-记一次架构优化实战与方案-底层服务优化 前言 程序员输出是他敲写的代码,那么输入就是他思考好的 ...
- python3 urllib及requests基本使用
在python中,urllib是请求url连接的标准库,在python2中,分别有urllib和urllib,在python3中,整合成了一个,称谓urllib 1.urllib.request re ...
- CISCO交换机-SNMP配置
1.1 SNMP基础配置 router> enable 进入路由器是用户模式 router# conf terminal 进入路由器的全局配置模式 #snmp-server commun ...
- Python-SMTP发送邮件(HTML、图片、附件)
前言: SMTP(Simple Mail Transfer Protocol)即简单邮件传输协议,它是一组用于由源地址到目的地址传送邮件的规则,由它来控制信件的中转方式. 一.Python发送HTML ...
- python-Selenium库的详解
一.什么是Selenium selenium 是一套完整的web应用程序测试系统,包含了测试的录制(selenium IDE),编写及运行(Selenium Remote Control)和测试的并行 ...
- python_内置函数1_42
内置函数 内置函数大全: Built-in Functions abs() dict() help() min() setattr() all() dir() hex() next() ...
- 关于function和task的说明
1. 关于函数function调用,总结两个要点: 1. 函数调用一般产生一个值,这个值被赋值给某个变量 2. 函数所返回的值只能是一个,不可以是多个,不能像C语言中采用指针的方式返回多个值.因 ...
- 1177: LFX学橙啦!题解
问题如下:先给你一个含有N个整数的数组数组中的每一个元素只为1或者0而N的大小为1~100你可以删除一些元素(也可以选择不删除),使剩下的数组中,没有一个元素0在1后面出现.并且要使剩下的元素的数量最 ...
- js总结:onClick=“return confirm()”实现确认以及取消表单的提交