您的位置:首页 > 运维架构 > Shell

shell脚本监控集群FTP是否正常,可上传下载文件

2015-04-28 21:47 633 查看
#!/bin/sh

########################################

#尝试登录集群各个节点,检查FTP是否可正常登录

#登录失败或者上传文件失败则发邮件通知

#######################################

if [ -s err.log ];then

rm -f err.log

fi

function login_ftp(){

ftp -i -n <<EOF

open $1

user $2 $3

put ltl_test

mdelete ltltest

bye

EOF

}

while read line;

do

eval "$line"

login_ftp $ip $user $user_pass >>33.log

if [ -s 33.log ];then

echo $ip $user $user_pass "login faile"\t >>err.log

fi

done < config

if [ -s err.log ];then

cat err.log|mail -s "check ftp" -t liu.tielei@zte.com.cn
fi

配置文件信息如下:

ip=10.45.47.190 user=weblogic user_pass=web123

ip=10.45.47.190 user=weblogic user_pass=web123

ip=10.45.47.190 user=weblogic user_pass=web123

ip=10.45.47.198 user=weblogic user_pass=web123
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: