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循环中,我们已经 ...
随机推荐
- ubuntu下无法在目录下创建文件夹,权限不足解决办法
问题详情:偶然在根目录创建文件夹的时候,突然显示错误,当时很惊讶,以前没遇见过这样的问题.当时界面是这样的. 用了一个 cd / 命令从用户磁盘跳到了根目录 使用 mkdir 命令准备创建一个文件夹, ...
- CentOS 7+nginx+PHP+php-fpm
根据网上资料配置: location ~ \.php$ { #include fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index in ...
- Python全栈开发之路 【第四篇】:Python基础之函数
本节内容 函数def: 1.位置参数,默认参数 2.位置参数,关键参数 3.如果参数中出现 *users,传递的参数就可以不再是固定的个数, 传过来的所有元素进行打包成元组 *args,**kwarg ...
- Python—生成器
列表生成式 现在有个需求,看列表[0, 1, 2, 3, 4, 5, 6, 7, 8, 9],要求你把列表里的每个值加1,你怎么实现? >>> a = [i+1 for i in r ...
- 1177: LFX学橙啦!题解
问题如下:先给你一个含有N个整数的数组数组中的每一个元素只为1或者0而N的大小为1~100你可以删除一些元素(也可以选择不删除),使剩下的数组中,没有一个元素0在1后面出现.并且要使剩下的元素的数量最 ...
- P124黎曼可积性刻画 的两个备注
1.这里为什么是开集? 2.请问为什么说了是开集马上就说是有界可测函数? 开集为可测集
- @SuppressWarnings("resource")
Suppress 抑制:镇压:废止 Warnings警告 @SuppressWarnings("resource")是J2SE 提供的一个批注.该批注的作用是给编译器一条指令,告 ...
- 将选中项的value值赋给select的title
$('select').change(function () { $(this).attr("title",$(this).find("option:selected&q ...
- VMWARE中NAT下获取不到IP
1.编辑-虚拟网络编辑器-dhcp设置 2.虚拟机-可移动设备-网络适配器-设置,注意:这里一定要选nat,当初我就是选了桥接,死活上不去,搞了2个小时.
- idea中 maven打包时时报错User setting file does not exist C:\Users\lenevo\.m2\setting.xml,
第一种错误 :idea中 maven打包时时报错User setting file does not exist C:\Users\lenevo\.m2\setting.xml, 解决方案如下:将ma ...