Skip to content

Latest commit

 

History

History
executable file
·
144 lines (131 loc) · 2.95 KB

qaclean

File metadata and controls

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