首页 > 其他 > 详细

云主机被挖矿的应急脚本

时间:2018-09-15 13:40:42      阅读:180      评论:0      收藏:0      [点我收藏+]

  当云主机被挖矿之后,一般都不能很快清除挖矿程序,而这时你的云主机cpu占用率会一直居高不下,为避免主机被锁定可先用这个脚本杀死挖矿程序,然后再来慢慢排查问题。

 

脚本内容:

#!/bin/bash

# This script is used to kill progress which having abnormal occupancy rate of CPU,

# I want through this way to protect my server from the hacker who attempting to use my server to mining.

# The method is capture PID which progress‘ occupancy rate of CPU greater than 90% by awk,then kill these PID.

while true;do

for i in `ps aux | awk ‘{if($3 > 90){print $2}}‘`;do

    kill -9 $i

done

done

云主机被挖矿的应急脚本

原文:https://www.cnblogs.com/RottenLeaf/p/9650707.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!