#!/bin/bash
# logs
# 2018/2/2 yeng

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH


check_error(){
if [ $? -eq 1 ];then
echo "$1 error" >/root/t.log
return 1
fi
}


iotops(){
#经测试得:这种情况不能在远程终端下用只能在真机的终端下用
iotop >1.txt <<EOF
q
EOF

check_error inputs error
cat 1.txt
}

main(){
iotops
if [ $? -eq 1 ];then
exit 1
fi
}

main