Skip to content

Instantly share code, notes, and snippets.

@jeansymolanza
Last active December 30, 2022 12:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeansymolanza/98c463bb8893b39b71d3effa45e0b53a to your computer and use it in GitHub Desktop.
Save jeansymolanza/98c463bb8893b39b71d3effa45e0b53a to your computer and use it in GitHub Desktop.
ps -eo pid,etime,comm,user | awk '{if ($3 ~ /KL/ || $3 ~ /kl/ && $2>604800) print $1, $4}' | while read pid user; do kill $pid; echo "Killed $pid process owned by $user which started running at $(ps -o lstart= -p $pid)" >> processes.txt; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment