Created
February 4, 2013 22:38
-
-
Save vikrum/4710398 to your computer and use it in GitHub Desktop.
Oh, don't mind me, I'm just running roughshod over your processes.
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
#!/bin/bash | |
# | |
# seek and kill a mem hog fork()'d child | |
# | |
SEEK="stud" | |
SNOOZE="6000" | |
while [ : ]; do | |
echo Snoozing for $SNOOZE | |
sleep $SNOOZE | |
LINE=`ps auxwf|grep $SEEK|grep -v grep|tail -n+2|sort -nk6|tail -1` | |
if [ -z "$LINE" ]; | |
then | |
echo No proc | |
else | |
PROC=`echo $LINE | awk '{print $2}'` | |
MEM=`echo $LINE | awk '{print $6}'` | |
echo The $SEEK pid $PROC is using $MEM ... killing it. | |
kill $PROC | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment