标签:bsp ps aux bash one 云主机 kill -9 脚本 被锁 避免
当云主机被挖矿之后,一般都不能很快清除挖矿程序,而这时你的云主机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
标签:bsp ps aux bash one 云主机 kill -9 脚本 被锁 避免
原文地址:https://www.cnblogs.com/RottenLeaf/p/9650707.html