skip # and blank line read file
来源:互联网 发布:python监控hp服务器 编辑:程序博客网 时间:2024/06/09 16:34
check hang process in server
file=$1
while read line
do
echo "line5:$line"
#skip comments
if [ "${line%%\#*}" == "" ]
then
continue
fi
#skip blank
if [ "${line%%\b*}" == "" ]
then
continue
fi
server=`echo $line|nawk '{ print $1 }'`
echo "line20:$server"
num=`rsh -n $server ps -ef |grep tweet |wc -l`------------------注意此处要用-n,否则rsh会自动读取下一行,造成1.txt读取错误
if [ $num -ne 1 ]
then
echo "hang up process:$server"
fi
done<$file
rsh cool0081 ps -fu tweet>1.txt
rsh cool0081 kill -9 1
while read line
do
echo $line |grep ps
if [ $? -eq 1 ]
then
echo "$?:$line"
else
echo "$?:$line"
fi
if [ $? -ne 1 ]
then
num=`echo $line |nawk '{print $3}'`
echo $num
rsh -n cool0081 kill -9 $num
fi
done <1.txt
- skip # and blank line read file
- How to read file line by line?
- Golang Read File line by line
- read and select file
- Read File and Parse
- file read and write
- Read the Last line in a file
- [shell]while read line do done < file
- Shell Script Utility To Read a File Line By Line
- Read file line by line (Bash shell script, sed usage)
- How to read a file line by line?
- Expect script to read file line by line
- Java 8 Stream – Read a file line by line
- Read and Write File Code
- Python file read and wirte
- read and write '.bmp' file
- read line from file with bash shell script
- Read Excel File And Format Records
- android平台应用性能测试之CPU和内存占用
- webservice实现服务器端与android通信
- android开发为什么很重要
- VS2010快捷键
- 内容网站首页设计经验分享
- skip # and blank line read file
- c#位移运算以及Unity3d的LayerMask原理
- LinkedHashMap和HashMap的比较使用
- android周边游app的技术memo
- java Volatile关键字介绍
- 进程和线程的区别与联系
- ANDROID垃圾回收器机制和强引用、软引用、弱引用、虚引用
- 我的第一个LiveCode安卓应用诞生啦Screen Test
- 包含min的栈