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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
#!/usr/bin/perl
# Interfaces of CORBA servers that need to die.
@idls = ("IDL:GNOME/Evolution/ShellComponent:1.0",
"IDL:GNOME/Evolution/CalFactory:1.0",
"IDL:GNOME/Evolution/BookFactory:1.0",
"IDL:GNOME/Evolution/Importer:1.0",
"IDL:GNOME/Evolution/IntelligentImporter:1.0",
"IDL:GNOME/Evolution/Shell:1.0",
"IDL:GNOME/Spell/Checker:0.1");
# IIDs of specific CORBA servers that need to die that don't implement
# useful interfaces (for querying, anyway)
@iids = ("OAFIID:GNOME_Evolution_Calendar_AlarmNotify_Factory",
"OAFIID:GNOME_GtkHTML_Editor_Factory",
"OAFIID:Bonobo_Moniker_xmldb_Factory");
##
## You shouldn't have to change anything below this point
##
$sysname=`uname -s`;
if ($sysname eq "SunOS") {
$killcmd="pkill";
}
else {
$killcmd="killall";
}
sub kill_exe {
my ($exe_name) = @_;
my $lt_name = "lt-$exe_name";
my $sub_exe_name = substr ($exe_name, 0, 16);
my $sub_lt_name = substr ($lt_name, 0, 16);
printf ("killing $exe_name\n");
$redirect = "2> /dev/null";
`$killcmd -9 $exe_name $redirect`;
`$killcmd -9 $lt_name $redirect`;
`$killcmd -9 $sub_exe_name $redirect`;
`$killcmd -9 $sub_lt_name $redirect`;
}
sub kill_exes {
while (($key, $value) = each %things_to_kill) {
&kill_exe($key);
}
}
sub add_exe {
my ($exe_name) = @_;
$things_to_kill{$exe_name} = $exe_name;
}
sub add_factory {
my ($factory_iid) = @_;
open (FACTORY_QUERY, "oaf-client -q -s \"iid == '$factory_iid'\"|");
while (<FACTORY_QUERY>) {
if (/type exe, location (.*)$/) {
&add_exe ($1);
}
}
close (FACTORY_QUERY);
}
# we need to do separate queries for iids because cvs OAF loses when
# you do more than one 'iid ==' separated by OR's. It returns a list
# of all CORBA servers. Cool, eh?
sub run_iid_query {
my $iid_query;
for ($i = 0; $i < @iids; $i++) {
$iid_query = "iid == '$iids[$i]'";
#printf ("$iid_query\n");
open (QUERY, "oaf-client -q -s \"$iid_query\"|");
while (<QUERY>) {
if (/type exe, location (.*)$/) {
&add_exe ($1);
}
elsif (/type factory, location (.*)$/) {
&add_factory ($1);
}
}
close (QUERY);
}
}
sub run_query {
my ($idl_query, $iid_query, $oaf_query);
$idl_query = "";
for ($i = 0; $i < @idls; $i++) {
$idl_query .= "repo_ids.has('$idls[$i]')";
$idl_query .= " OR " if ($i < @idls - 1);
}
#$iid_query = "";
#for ($i = 0; $i < @iids; $i++) {
# $iid_query .= "iid == '$iids[$i]'";
# $iid_query .= " OR " if ($i < @iids - 1);
#}
$oaf_query = $idl_query;
#$oaf_query .= " OR $iid_query" if (@iids > 0);
#printf ("$oaf_query\n");
open (QUERY, "oaf-client -q -s \"$oaf_query\"|");
while (<QUERY>) {
if (/type exe, location (.*)$/) {
&add_exe ($1);
}
elsif (/type factory, location (.*)$/) {
&add_factory ($1);
}
}
close (QUERY);
}
&run_query ();
&run_iid_query ();
&kill_exes();
|