forked from AppScale/gts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathterminate.rb
148 lines (128 loc) · 3.42 KB
/
terminate.rb
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
$:.unshift File.join(File.dirname(__FILE__), "lib")
begin
require 'cron_helper'
CronHelper.clear_crontab
rescue Exception
puts "Problem with cronhelper, moving on"
end
begin
require 'load_balancer'
LoadBalancer.stop
rescue Exception
puts "Problem with loadbalancer, moving on"
end
begin
require 'monitoring'
Monitoring.stop
rescue Exception
puts "Problem with monitoring, moving on"
end
begin
require 'haproxy'
HAProxy.clear_sites_enabled
HAProxy.stop
rescue Exception
puts "Problem with haproxy, moving on"
end
begin
require 'collectd'
Collectd.clear_sites_enabled
Collectd.clear_monitoring_data
Collectd.stop
rescue Exception
puts "Problem with collectd, moving on"
end
begin
require 'nginx'
Nginx.clear_sites_enabled
Nginx.stop
rescue Exception
puts "Problem with nginx, moving on"
end
begin
require 'godinterface'
GodInterface.shutdown()
rescue Exception
puts "Problem with god, moving on"
end
APPSCALE_HOME = ENV['APPSCALE_HOME']
begin
require 'pbserver'
tree = YAML.load_file("#{APPSCALE_HOME}/.appscale/database_info.yaml")
PbServer.stop(tree[:table])
rescue Exception
puts "Problem with pbserver, moving on"
end
`bash #{APPSCALE_HOME}/AppController/killDjinn.sh`
# we should not call appscale-controller because it is parent.
#`service appscale-controller stop`
`rm -f #{APPSCALE_HOME}/.appscale/secret.key`
#`rm -rf /tmp/*.log`
#`rm -rf /tmp/h*`
`rm -f #{APPSCALE_HOME}/.appscale/status-*`
`rm -f #{APPSCALE_HOME}/.appscale/database_info`
`rm -f #{APPSCALE_HOME}/.appscale/neptune_info.txt`
`rm -f /tmp/uploaded-apps`
`rm -f ~/.appscale_cookies`
`rm -f /var/log/appscale/*.log`
`rm -f /var/appscale/*.pid`
`rm -f /etc/appscale/appcontroller-state.json`
#Ejabberd.stop
#Ejabberd.clear_online_users
# klogd is installed on jaunty but not karmic
klogd = "/etc/init.d/klogd"
if File.exists?(klogd)
`#{klog} stop`
end
# TODO(cgb): Use FileUtils.rm_rf
# I remember it had some problems with *s, so look into that
# maybe glob it with Dir.glob? to alleviate this?
`rm -rf /var/apps/`
`rm -rf #{APPSCALE_HOME}/.appscale/*.pid`
`rm -rf /tmp/ec2/*`
`rm -rf /tmp/*started`
`rm -rf #{APPSCALE_HOME}/appscale/`
`rm -rf /var/appscale/memcachedb/*`
`rm -rf /var/appscale/cassandra/commitlog/*`
`rm -rf /var/appscale/cassandra/data/system/*`
`rm -rf /var/appscale/zookeeper/*`
# TODO(cgb): Use the constant in djinn.rb (ZK_LOCATIONS_FILE)
`rm -rf /etc/appscale/zookeeper_locations.json`
`rm -rf /var/cache/neptune/*`
`echo "" > /root/.ssh/known_hosts` # empty it out but leave the file there
# force kill processes
["memcached",
"nginx", "haproxy", "collectd", "collectdmon",
"soap_server", "appscale_server",
"AppLoadBalancer", "AppMonitoring",
# AppServer
"dev_appserver", "DevAppServerMain",
#Blobstore
"blobstore_server",
# Cassandra
"CassandraDaemon",
# Hadoop
"NameNode", "DataNode", "JobTracker", "TaskTracker",
# HBase, ZooKeeper
"HMaster", "HRegionServer", "HQuorumPeer", "QuorumPeerMain",
"ThriftServer",
# Hypertable
"Hyperspace", "Hypertable.Master", "Hypertable.RangeServer", "ThriftBroker",
"DfsBroker",
# Memcachedb
"memcachedb",
# MongoDB
"mongod", "mongo", "mongos",
# MySQL
"ndb_mgmd", "ndbd", "mysqld",
# Scalaris
"activemq",
"beam", "epmd",
# Voldemort
"VoldemortServer",
"rabbitmq",
"thin", "god", "djinn", "xmpp_receiver",
"InfrastructureManager", "Neptune"
].each do |program|
`ps ax | grep #{program} | grep -v grep | awk '{ print $1 }' | xargs -d '\n' kill -9`
end