forked from CMSCompOps/WmAgentScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
condor_rm48h.sh
executable file
·42 lines (33 loc) · 970 Bytes
/
condor_rm48h.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
source ~cmst1/.bashrc
agentenv
tmp=`mktemp`
condor_overview | sed -n '/48 hours by workflow/,/-----/p' | grep " : " >> $tmp
while read line ; do
WF=`echo "$line" | awk -F' : ' '{print $1}'`
Jobs=`echo "$line" | awk -F' : ' '{print $2}'`
echo "Checking : " $WF
nRem=0
for iJob in $Jobs ; do
nStarts=`condor_q -l $iJob | grep NumJobStarts | awk -F' = ' '{print $2}'`
if [[ $nStarts -gt 1 ]]; then
condor_rm $iJob
nRem=`expr $nRem + 1`
fi
done
echo " ---> "$nRem" Jobs Removed"
done < "$tmp"
rm $tmp
tmp=`mktemp`
condor_overview | sed -n '/Jobs with RemoveReason!=UNDEFINED/,/-----/p' | grep " : " >> $tmp
while read line ; do
WF=`echo "$line" | awk -F' : ' '{print $1}'`
Jobs=`echo "$line" | awk -F' : ' '{print $2}'`
echo "Checking : " $WF
nRem=0
for iJob in $Jobs ; do
condor_rm -forcex $iJob
nRem=`expr $nRem + 1`
done
done < "$tmp"
rm $tmp