Skip to content

Instantly share code, notes, and snippets.

@jperkin
Last active April 1, 2021 08:33
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 jperkin/e420d9bc30d2a8d8925467756bb445ab to your computer and use it in GitHub Desktop.
Save jperkin/e420d9bc30d2a8d8925467756bb445ab to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# Look for any cmake_autogen processes that have been running for longer than
# 1 hour, these are not caught by the ulimit -t set by pbulk as they are not
# using any CPU time.
#
# Run from cron and redirect output to a log
#
for pid in $(pgrep -f cmake_autogen); do
#
# Match when the ETIME field is hh:mm:ss or longer.
#
case "$(ps -o etime= -p ${pid} 2>/dev/null)" in
*:*:*)
# Output running command for the log.
ps -ww -o user,pid,lstart,etime,args -p ${pid}
kill $pid
;;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment