timeout可以实现当一个命令在规定时间内不返回就强制返回的功能 + 杀毒安装ClamAV

[root@xiaowei ~]# cat telnetport.sh 
#!/bin/bash
Port=25223
timeout 2 ssh [email protected] "telnet   61.146.164.67  $Port " > /tmp/telnet$Port.txt
timeout 2 ssh [email protected] "telnet   61.146.164.67  $Port " >> /tmp/telnet$Port.txt
timeout 2 ssh [email protected] "telnet   61.146.164.67  $Port " >> /tmp/telnet$Port.txt



result=`grep -c 'Escape' /tmp/telnet$Port.txt`
if [[ $result != 3 ]];then
	echo "problem"
        curl -d  "token=21bd1fb7f4fe5bbe86b5a03a9874c9061d144&room_name=22d13a924daf805b1&chat_im_users=&chat_content=from XIAOWEI test for alert" http://172.16.10.7:45101/outer/common/chat/room/sendmessage
       
fi
参考:Telnet  https://blog.csdn.net/weixin_39845407/article/details/81486041
Linux杀毒 https://blog.csdn.net/weixin_39845407/article/details/81780125

猜你喜欢

转载自www.cnblogs.com/hixiaowei/p/10434820.html