-
-
Save jtoy/2520214 to your computer and use it in GitHub Desktop.
Shell script to kill orphaned Hadoop Task processes
This file contains hidden or 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 | |
# Kill tasks holding on to deleted userlogs. These are most likely abandoned jobs. | |
function get_bad_pids { | |
for i in `ps -ef | grep java | awk '{print $2;}'`; do | |
cnt=`/usr/sbin/lsof -p $i | grep deleted | grep /var/log/hadoop-0.20/userlogs/attempt | wc -l`; | |
if [ $cnt -gt 0 ]; then | |
PIDS=$i:$PIDS; | |
fi | |
done | |
} | |
PIDS="" | |
get_bad_pids | |
IFS=':' | |
for pid in $PIDS; do | |
kill -9 $pid; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment