Imported Upstream version 3.16.3
[platform/upstream/nss.git] / tests / core_watch
1 #############################################################
2 # script to watch for cores during QA runs, so they won't overwrite one
3 # another
4 # Not activated for efficiency reasons, and problems on MKS, us
5 # only when needed and remember to remove afterwards
6 #############################################################
7
8 #############################################################
9 # to activate put the following into all.sh (after the HOSTDIR 
10 # has been exported
11 #############################################################
12 # sh `dirname $0`/core_watch $HOSTDIR ${HOSTDIR} &    
13 # CORE_WATCH_PID=$!
14 # if [ -n "${KILLPIDS}" ]
15 # then
16 #     echo $CORE_WATCH_PID >>"${KILLPIDS}"            
17 # fi
18 #############################################################
19
20 #############################################################
21 # or put the following into nssqa to watch the whole RESULTDIR
22 # start it shortly before run_all
23 #
24 # NOTE: the more efficient way is above, this is potentially going
25 # thru 1000ds of files every 30 seconds
26 #############################################################
27 # sh `dirname $0`/core_watch $RESULTDIR &    
28 # echo $! >>"${KILLPIDS}"        #so Exit() can hopefully kill the core_watch
29 #############################################################
30
31 # in both cases remember to kill the process when done, since 
32 # the PIDs that end up in ${KILLPIDS} might not work for all OS
33 # something like "kill_by_name core_watch
34
35 echo $$ >>"${KILLPIDS}"     #so Exit() can hopefully kill this shell
36 while [ 1 ]
37 do
38     for w in `find $1 -name "core" -print`
39     do
40         echo "Found core $w"
41         mv $w $w.`date +%H%M%S`
42     done
43     sleep 30
44 done
45