Add a script to kill long running projects for stalled rsyncs

git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@555381 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Carlos Sanchez Gonzalez 2007-07-11 19:59:53 +00:00
parent eb7d25d8e1
commit 9fdd8b4d26
1 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,22 @@
#!/bin/bash
##
##Usage: <scriptname> <process name> <timeout in hours>
##
ps -eo comm,etime,pid |
grep $1|
awk -v TIMEOUT=4 '
{
if($2~/-/){
system("kill -9 "$3);
}
else{
tl=split($2, tm, ":");
print tl;
if(tl==3 && tm[1]>TIMEOUT){
system("kill -9 "$3);
}
}
}'