Last active
April 1, 2021 08:33
-
-
Save jperkin/e420d9bc30d2a8d8925467756bb445ab to your computer and use it in GitHub Desktop.
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/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