Created
May 6, 2020 20:53
-
-
Save schultzisaiah/756d87613b1069b3e5bc5a68157504a3 to your computer and use it in GitHub Desktop.
Auto kill a resource-hogging process
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# AUTO-KILL iCoreService using more than 60% CPU | |
# run as super user (sudo ./auto-kill-process.sh) | |
while true | |
do | |
PID=$(ps aux | grep 'iCoreService' | grep -v grep | awk '{ if ($3 >= 60.0) { print $2 } }' | head -n 1) | |
if [ ! -z "$PID" ] | |
then | |
kill -9 $PID | |
date >> iCoreService-kills.log | |
fi | |
sleep 5 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment