标签:shell
shell采集系统 内存 cpu 网络信息 磁盘 信息
cpu信息采集cpu使用率采集算法通过/proc/stat文件采集并计算CPU总使用率或者单个核使用率。以cpu0为例,算法如下:1. cat /proc/stat | grep ‘cpu0’得到cpu0的信息2. cpuTotal1=user+nice+system+idle+iowait+irq+softirq3. cpuUsed1=use……
shell与if相关参数
[ -a FILE ] 如果 FILE 存在则为真。[ -b FILE ] 如果 FILE 存在且是一个块特殊文件则为真。[ -c FILE ] 如果 FILE 存在且是一个字特殊文件则为真。[ -d FILE ] 如果 FILE 存在且是一个目录则为真。[ -e FILE ] 如果 FILE 存在则为真。[ -f FILE ] 如果 FILE 存……
Linux下多行合并成一行,中间加分隔符
将某个目录下的文件合并成一行,中间用冒号(:)作为分隔符1、pastels lib | sed 's@^@lib/@g' | paste -s -d ":"2、 trls lib | sed 's@^@lib/@g' | tr "\n" ":&quo……
shell字符串处理
字符串操作(长度,读取,替换)表达式含义${#string}$string的长度${string:position}在$string中, 从位置$position开始提取子串${string:position:length}在$string中, 从位置$position开始提取长度为$length的子串${stri……
Tomcat启动SHELL脚本
Tomcat启动SHELL脚本脚本内容如下:#!/bin/bash # # chkconfig: - 95 15 # description: Tomcat start/stop/status script #Location of JAVA_HOME (bin files) export JAVA_HOME= ……
linux循环递归读取目录指定类型文件及计算阶乘脚本
linux循环读取目录指定类型文件脚本ergodic.sh#!/bin/bashfunction ergodic{ for file in ` ls $1` do if [ -d $1"/"$file ] then ……