简体   繁体   English

向我发送电子邮件并重新启动tomcat攻击DDOS的脚本

[英]Script to send me an e-mail and reboot tomcat attack DDOS

I need help to have a script to send me an e-mail alert when system resource intensive CPU and memory. 当系统资源占用大量CPU和内存时,我需要帮助来编写脚本以向我发送电子邮件警报。 I would also be interested in a script that when the tomcat is reaching the limits of its resources reboot my pc (This script would be to prevent DDOS attacks). 我还要对一个脚本感兴趣,该脚本是当tomcat达到其资源极限时,重新启动我的电脑(此脚本将是为了防止DDOS攻击)。

I wish you could help me !! 我希望你能帮助我! Thank you 谢谢

SOLUTION!!!! 解!!!!

Here is the script of which I spoke. 这是我讲的剧本。 This script will automatically restart the Tomcat when it exceeds 95% of physical memory. 当该脚本超过物理内存的95%时,它将自动重新启动Tomcat。 Enjoy it !! 好好享受 !!

porcentaje=95 porcentaje = 95

usoMemoria=$(ps aux | grep tomcat | grep -v grep | awk '{printf ("%.0f", $4)}') usoMemoria = $(ps aux | grep tomcat | grep -v grep | awk'{printf(“%.0f”,$ 4)}')

if [ $usoMemoria -ge $porcentaje ]; 如果[$ usoMemoria -ge $ porcentaje]; then 然后

echo "Se ha superado el tope (95%) de memoria que se ha establecido para el Tomcat. Se procede a su reinicio automatico" 回声“雄猫的超级英雄(95%)在雄猫的比赛中获得胜利。

echo "$(date)" 回声“ $(日期)”

echo "Comenzando..." 回声“ Comenzando ...”

service tomcat7 restart 服务tomcat7重新启动

echo "Terminando Script..." 回声“ Terminando脚本...”

fi 科幻

exit 0 出口0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM