tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

qaclean (3016B)


      1 #! /bin/sh
      2 
      3 ########################################################################
      4 #
      5 # /u/sonmi/bin/qaclean
      6 #
      7 # is supposed to clean up after a "hanging" QA
      8 #
      9 # 1) see if there is a lockfile 
     10 #    if yes: 
     11 #    1a) kill the process of the lockfile and if possible it's children
     12 #    1b) rm the lockfile
     13 # 2) kill selfservers
     14 # 3) clean up old tmp files
     15 #
     16 ########################################################################
     17 
     18 if [ -z "$TMP" ]
     19 then
     20     if [  -z "$TEMP" ]
     21     then
     22         TMP="/tmp"
     23     else
     24         TMP=$TEMP
     25     fi
     26 fi
     27 if [ ! -w "$TMP" ]
     28 then
     29     echo "Can't write to tmp directory $TMP - exiting"
     30     echo "Can't write to tmp directory $TMP - exiting" >&2
     31     exit 1
     32 fi
     33 
     34 ########################### Ps #########################################
     35 # platform specific ps
     36 ########################################################################
     37 Ps()
     38 {
     39     if [ `uname -s` = "SunOS" ]
     40     then
     41         /usr/5bin/ps -e
     42     else
     43         ps -e
     44     fi
     45 }
     46 
     47 Kill()
     48 {
     49     if [ "$1" = "$$" ]
     50     then
     51         return
     52     fi
     53     echo "Killing PID $1"
     54     kill $1
     55     sleep 1
     56     kill -9 $1 2>/dev/null
     57 }
     58 
     59 ########################### kill_by_name ################################
     60 # like killall, only without permissionproblems, kills the process whose 
     61 # name is given as parameter
     62 ########################################################################
     63 kill_by_name()
     64 {
     65     echo "Killing all $1"
     66  
     67     for PID in `Ps | grep "$1" | grep -v grep | \
     68         sed -e "s/^[     ]*//g" -e "s/[     ].*//"`
     69     do
     70         Kill $PID
     71     done
     72 }
     73 
     74 kill_the_rest()
     75 {
     76 i=0
     77 while [ $i -lt $1 ]
     78 do
     79     kill_by_name nssqa
     80     kill_by_name selfserv
     81     kill_by_name strsclnt
     82     kill_by_name all.sh
     83     kill_by_name sdr.sh
     84     kill_by_name ssl.sh
     85     kill_by_name smime.sh
     86     i=`expr $i + 1`
     87 done
     88 }
     89 
     90 nt_warning()
     91 {
     92 os_name=`uname -s`
     93 case $os_name in
     94     CYGWIN*|WIN*|Win*)
     95         echo
     96         echo
     97         echo
     98         echo "Another Windows problem... If you have not already done so"
     99         echo "after this script completes, please reboot, and log in as"
    100         echo "user svbld again"
    101         echo
    102         echo
    103         echo
    104         ;;
    105 esac
    106 }
    107 
    108 nt_warning
    109 case $1 in 
    110     -all)
    111         for w in tommy booboo kentuckyderby galileo shame axilla columbus \
    112                  smarch charm hp64 biggayal orville kwyjibo hbombaix raven \
    113                  jordan hornet phaedrus louie box dbldog huey washer dryer \
    114                  shabadoo trex bummer compaqtor jellyfish sjsu
    115         do
    116                 echo $w
    117                 ping $w && rsh $w '/u/sonmi/bin/qaclean'
    118         done
    119 
    120         ;;
    121     ?*)
    122         rsh $1 '/u/sonmi/bin/qaclean'
    123         exit
    124         ;;
    125 esac
    126 
    127 uname -a
    128 echo
    129 
    130 if [ -f ${TMP}/nssqa.* ]
    131 then
    132     echo "nssqa seems to be running ${TMP}/nssqa.*"
    133     #cat ${TMP}/nssqa.*
    134     NSSQA_PID=`ls ${TMP}/nssqa.* | sed -e 's/[^.]*\.//'`
    135     Kill $NSSQA_PID
    136     rm ${TMP}/nssqa.*
    137 fi
    138 
    139 kill_the_rest 3
    140 ls -l ${TMP}/nsstmp.*
    141 rm ${TMP}/nsstmp.* 2>/dev/null
    142 rm ${TMP}/certutilout.* 2>/dev/null
    143 rm ${TMP}/Pk12*
    144 nt_warning