psadmin_plus 2.0.4 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/psa +156 -132
- data/lib/psadmin_plus.rb +636 -537
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5811dc395997ea722f4b5c15f2d6552e9c0c351ade9c64346a9007ea3d600f6b
|
4
|
+
data.tar.gz: 6785104563ac2b0cef79dce06bfc5980947c32bec12649bad37327b858fba4fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb1dcae5cbbbd435802ddb7a546c892af6a68c6b172297ceec562db30762cc07079bbdb3833ad1c9eaa52f787fc853f79d1a9d4dc0dfdffb0c74267e2d02711b
|
7
|
+
data.tar.gz: 01cef0fd3725cf5801df399f310bfc2e7eb9d7a940522a701978e71398a71e336e07f3976e20407413384205d340f83bc7691889476dae34131b469c32bfbcc5
|
data/bin/psa
CHANGED
@@ -1,132 +1,156 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
if
|
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
|
-
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'psadmin_plus'
|
5
|
+
rescue LoadError
|
6
|
+
# running directly, not through gem install
|
7
|
+
require_relative '../lib/psadmin_plus.rb'
|
8
|
+
end
|
9
|
+
|
10
|
+
# options
|
11
|
+
opts_c = ARGV.shift || "help"
|
12
|
+
opts_t = ARGV.shift || "all"
|
13
|
+
opts_d = ARGV.shift || "all"
|
14
|
+
# Set remaining arguments as environment variables
|
15
|
+
ARGV.each do |arg|
|
16
|
+
if arg.include? "="
|
17
|
+
var = arg.split('=')
|
18
|
+
ENV[var[0]]=var[1]
|
19
|
+
puts "Setting environment variable " + var[0] + "=" + var[1]
|
20
|
+
else
|
21
|
+
# puts "Skip argument, no valid environment variable found."
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
commands = opts_c.split(',')
|
26
|
+
types = opts_t.split(',')
|
27
|
+
domains = opts_d.split(',')
|
28
|
+
|
29
|
+
if types.include? "all" then types = ['app','prcs','web'] end
|
30
|
+
if domains.include? "all" then all_domains = true end
|
31
|
+
|
32
|
+
# setup environment
|
33
|
+
PS_PSA_CONF = ENV['PS_PSA_CONF'] || "#{ENV['HOME']}/.psa.conf"
|
34
|
+
if File.exists?(PS_PSA_CONF) then
|
35
|
+
File.readlines(PS_PSA_CONF).each do |line|
|
36
|
+
if line.start_with? "#" then
|
37
|
+
next
|
38
|
+
else
|
39
|
+
key, value = line.split "="
|
40
|
+
value.nil? ? next : ENV[key] = value.strip
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# constants
|
46
|
+
OS_CONST = os
|
47
|
+
PS_RUNTIME_USER = ENV['PS_RUNTIME_USER'] || "psadm2"
|
48
|
+
PS_HOOK_INTERP = ENV['PS_HOOK_INTERP'] || "ruby"
|
49
|
+
PS_HOOK_PRE = ENV['PS_HOOK_PRE'] || "false"
|
50
|
+
PS_HOOK_POST = ENV['PS_HOOK_POST'] || "false"
|
51
|
+
PS_HOOK_START = ENV['PS_HOOK_START'] || "false"
|
52
|
+
PS_HOOK_STOP = ENV['PS_HOOK_STOP'] || "false"
|
53
|
+
PS_PSA_SUDO = ENV['PS_PSA_SUDO'] || "on"
|
54
|
+
PS_PSADMIN_PATH = "#{OS_CONST}" == "linux" ? "#{env('PS_HOME')}/bin" : "cmd /c #{env('PS_HOME')}/appserv"
|
55
|
+
PS_WIN_SERVICES = ENV['PS_WIN_SERVICES'] || "false"
|
56
|
+
PS_TRAIL_SERVICE = ENV['PS_TRAIL_SERVICE'] || "false"
|
57
|
+
PS_MULTI_HOME = ENV['PS_MULTI_HOME'] || "false"
|
58
|
+
PS_MULTI_DELIMIT = ENV['PS_MULTI_DELIMIT'] || "/"
|
59
|
+
PS_MULTI_PREFIX = ENV['PS_MULTI_PREFIX'].to_i || 0
|
60
|
+
PS_PARALLEL_BOOT = ENV['PS_PARALLEL_BOOT'] || "false"
|
61
|
+
PS_PSA_DEBUG = ENV['PS_PSA_DEBUG'] || "false"
|
62
|
+
|
63
|
+
# validation
|
64
|
+
# check runtime user
|
65
|
+
if "#{OS_CONST}" == "linux" then
|
66
|
+
if !system("id #{PS_RUNTIME_USER} &> /dev/null") then
|
67
|
+
puts "#{PS_RUNTIME_USER} is not valid. Please correct PS_RUNTIME_USER, then try again."
|
68
|
+
exit
|
69
|
+
end
|
70
|
+
else
|
71
|
+
# windows - TODO
|
72
|
+
end
|
73
|
+
|
74
|
+
# process
|
75
|
+
commands.each do |c|
|
76
|
+
case "#{c}"
|
77
|
+
when "help"
|
78
|
+
do_help
|
79
|
+
when "admin"
|
80
|
+
do_admin
|
81
|
+
when "util"
|
82
|
+
do_util
|
83
|
+
when "list"
|
84
|
+
do_list
|
85
|
+
when "summary"
|
86
|
+
do_summary
|
87
|
+
else
|
88
|
+
types.each do |t|
|
89
|
+
# find valid domains for this type
|
90
|
+
case "#{t}"
|
91
|
+
when "app"
|
92
|
+
valid_domains = find_apps
|
93
|
+
when "pubsub"
|
94
|
+
valid_domains = find_apps # TODO - find only apps with PUBSUB enabled?
|
95
|
+
when "prcs"
|
96
|
+
valid_domains = find_prcss
|
97
|
+
when "web"
|
98
|
+
valid_domains = find_webs
|
99
|
+
end
|
100
|
+
|
101
|
+
if all_domains then
|
102
|
+
domains = valid_domains
|
103
|
+
end
|
104
|
+
|
105
|
+
domains.each do |d|
|
106
|
+
# validate domain for current type
|
107
|
+
if valid_domains.include? d
|
108
|
+
do_hookpre(c,t,d)
|
109
|
+
do_set_cfg_home(d)
|
110
|
+
|
111
|
+
case "#{c}"
|
112
|
+
when "status"
|
113
|
+
do_cmd_banner(c,t,d)
|
114
|
+
do_status(t,d)
|
115
|
+
when "start"
|
116
|
+
do_cmd_banner(c,t,d)
|
117
|
+
do_start(t,d)
|
118
|
+
when "stop"
|
119
|
+
do_cmd_banner(c,t,d)
|
120
|
+
do_stop(t,d)
|
121
|
+
when "kill"
|
122
|
+
do_cmd_banner(c,t,d)
|
123
|
+
do_kill(t,d)
|
124
|
+
when "configure"
|
125
|
+
do_cmd_banner(c,t,d)
|
126
|
+
do_configure(t,d)
|
127
|
+
when "reconfigure"
|
128
|
+
do_cmd_banner(c,t,d)
|
129
|
+
do_reconfigure(t,d)
|
130
|
+
when "purge"
|
131
|
+
do_cmd_banner(c,t,d)
|
132
|
+
do_purge(t,d)
|
133
|
+
when "flush"
|
134
|
+
do_cmd_banner(c,t,d)
|
135
|
+
do_flush(t,d)
|
136
|
+
when "restart"
|
137
|
+
do_cmd_banner(c,t,d)
|
138
|
+
do_restart(t,d)
|
139
|
+
when "bounce"
|
140
|
+
do_cmd_banner(c,t,d)
|
141
|
+
do_bounce(t,d)
|
142
|
+
else
|
143
|
+
puts "Not a valid command. See psa help"
|
144
|
+
end
|
145
|
+
|
146
|
+
do_hookpost(c,t,d)
|
147
|
+
else
|
148
|
+
if ENV['PS_PSA_DEBUG'] == "true"
|
149
|
+
do_cmd_banner(c,t,d)
|
150
|
+
puts "No valid domain found for this type."
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
data/lib/psadmin_plus.rb
CHANGED
@@ -1,537 +1,636 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'rbconfig'
|
4
|
-
require 'etc'
|
5
|
-
require 'open3'
|
6
|
-
|
7
|
-
def do_help
|
8
|
-
puts "Usage: psa [command] <type> <domain>"
|
9
|
-
puts " "
|
10
|
-
puts "Commands:"
|
11
|
-
puts " "
|
12
|
-
puts " help display this help message"
|
13
|
-
puts " list list domains"
|
14
|
-
#puts " admin launch psadmin"
|
15
|
-
puts " summary PS_CFG_HOME summary, no type or domain needed"
|
16
|
-
puts " status status of the domain"
|
17
|
-
puts " start
|
18
|
-
puts " stop
|
19
|
-
puts " restart stop and start the domain"
|
20
|
-
puts " purge clear domain cache"
|
21
|
-
puts " reconfigure stop, configure, and start the domain"
|
22
|
-
puts " bounce stop, flush, purge, configure and start the domain"
|
23
|
-
puts " kill force stop the domain"
|
24
|
-
puts " configure configure the domain"
|
25
|
-
puts " flush clear domain IPC"
|
26
|
-
puts "
|
27
|
-
puts "
|
28
|
-
puts " "
|
29
|
-
puts "
|
30
|
-
puts "
|
31
|
-
puts "
|
32
|
-
puts "
|
33
|
-
puts "
|
34
|
-
puts "
|
35
|
-
puts "
|
36
|
-
puts "
|
37
|
-
puts "
|
38
|
-
puts "
|
39
|
-
puts "
|
40
|
-
puts " "
|
41
|
-
puts "
|
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
|
-
puts ""
|
106
|
-
puts "
|
107
|
-
end
|
108
|
-
|
109
|
-
def
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
end
|
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
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
end
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
end
|
184
|
-
|
185
|
-
def
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
puts "
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
end
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
#
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
end
|
253
|
-
|
254
|
-
def
|
255
|
-
if
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
#
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
when "web"
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
when "
|
347
|
-
case "#{PS_WIN_SERVICES}"
|
348
|
-
when "true"
|
349
|
-
do_cmd(
|
350
|
-
else
|
351
|
-
do_cmd(
|
352
|
-
case "#{PS_TRAIL_SERVICE}"
|
353
|
-
when "true"
|
354
|
-
do_cmd(
|
355
|
-
end
|
356
|
-
end
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
end
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
when "
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
end
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
ENV['
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
end
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
end
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
#
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rbconfig'
|
4
|
+
require 'etc'
|
5
|
+
require 'open3'
|
6
|
+
|
7
|
+
def do_help
|
8
|
+
puts "Usage: psa [command] <type> <domain>"
|
9
|
+
puts " "
|
10
|
+
puts "Commands:"
|
11
|
+
puts " "
|
12
|
+
puts " help display this help message"
|
13
|
+
puts " list list domains"
|
14
|
+
#puts " admin launch psadmin"
|
15
|
+
puts " summary PS_CFG_HOME summary, no type or domain needed"
|
16
|
+
puts " status status of the domain"
|
17
|
+
puts " start hookstart, if enabled, then start the domain"
|
18
|
+
puts " stop hookstop, if enabled, stop the domain"
|
19
|
+
puts " restart stop and start the domain"
|
20
|
+
puts " purge clear domain cache"
|
21
|
+
puts " reconfigure stop, configure, and start the domain"
|
22
|
+
puts " bounce stop, flush, purge, configure and start the domain"
|
23
|
+
puts " kill force stop the domain"
|
24
|
+
puts " configure configure the domain"
|
25
|
+
puts " flush clear domain IPC"
|
26
|
+
puts " "
|
27
|
+
puts "Types:"
|
28
|
+
puts " "
|
29
|
+
puts " app act on application domains"
|
30
|
+
#puts " pubsub act on PUBSUB group of application domains"
|
31
|
+
puts " prcs act on process scheduler domains"
|
32
|
+
puts " web act on web domains"
|
33
|
+
puts " all,<blank> act on web, app, and prcs domains"
|
34
|
+
puts " "
|
35
|
+
puts "Domains:"
|
36
|
+
puts " "
|
37
|
+
puts " dom act on specific domains"
|
38
|
+
puts " all,<blank> act on all domains"
|
39
|
+
puts " "
|
40
|
+
puts "Each parameter type can be enter in a comma separated list "
|
41
|
+
puts " "
|
42
|
+
end
|
43
|
+
|
44
|
+
def do_is_runtime_user_nix
|
45
|
+
result = ENV['USER'] == PS_RUNTIME_USER ? true : false
|
46
|
+
end
|
47
|
+
|
48
|
+
def do_is_runtime_user_win
|
49
|
+
result = ENV['USERNAME'] == PS_RUNTIME_USER ? true : false
|
50
|
+
end
|
51
|
+
|
52
|
+
def env(var)
|
53
|
+
result = "#{OS_CONST}" == "linux" ? "${#{var}}" : "%#{var}%"
|
54
|
+
end
|
55
|
+
|
56
|
+
def do_cmd(cmd, print = true, powershell = true)
|
57
|
+
case "#{OS_CONST}"
|
58
|
+
when "linux"
|
59
|
+
if do_is_runtime_user_nix
|
60
|
+
case "#{PS_PSA_DEBUG}"
|
61
|
+
when "true"
|
62
|
+
p "Command: #{cmd}"
|
63
|
+
end
|
64
|
+
out = `#{cmd}`
|
65
|
+
else
|
66
|
+
if "#{PS_PSA_SUDO}" == "on"
|
67
|
+
case "#{PS_PSA_DEBUG}"
|
68
|
+
when "true"
|
69
|
+
p "Command: sudo su - #{PS_RUNTIME_USER} -c '#{cmd}'"
|
70
|
+
end
|
71
|
+
out = `sudo su - #{PS_RUNTIME_USER} -c '#{cmd}'`
|
72
|
+
else
|
73
|
+
print "#{PS_RUNTIME_USER} "
|
74
|
+
case "#{PS_PSA_DEBUG}"
|
75
|
+
when "true"
|
76
|
+
p "Command: su - #{PS_RUNTIME_USER} -c '#{cmd}'"
|
77
|
+
end
|
78
|
+
out = `su - #{PS_RUNTIME_USER} -c '#{cmd}'`
|
79
|
+
end
|
80
|
+
end
|
81
|
+
when "windows"
|
82
|
+
case powershell
|
83
|
+
when true
|
84
|
+
case "#{PS_PSA_DEBUG}"
|
85
|
+
when "true"
|
86
|
+
p "Command: powershell -NoProfile -Command \"#{cmd}\""
|
87
|
+
end
|
88
|
+
out = `powershell -NoProfile -Command "#{cmd}"`
|
89
|
+
else
|
90
|
+
case "#{PS_PSA_DEBUG}"
|
91
|
+
when "true"
|
92
|
+
p "Command: #{cmd}"
|
93
|
+
end
|
94
|
+
out = `#{cmd}`
|
95
|
+
end
|
96
|
+
else
|
97
|
+
out = "Invalid OS"
|
98
|
+
end
|
99
|
+
print ? (puts out) : result = out
|
100
|
+
out
|
101
|
+
end
|
102
|
+
|
103
|
+
def do_cmd_banner(c,t,d)
|
104
|
+
puts ""
|
105
|
+
puts "===[ #{c} . #{t} . #{d} ]==="
|
106
|
+
puts ""
|
107
|
+
end
|
108
|
+
|
109
|
+
def do_set_cfg_home(d)
|
110
|
+
if "#{PS_MULTI_HOME}" != "false"
|
111
|
+
if PS_MULTI_PREFIX > 0
|
112
|
+
h = d.slice(0..PS_MULTI_PREFIX)
|
113
|
+
else
|
114
|
+
h = d
|
115
|
+
end
|
116
|
+
ENV['PS_CFG_HOME'] = "#{PS_MULTI_HOME}#{PS_MULTI_DELIMIT}#{h}"
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
def find_apps_nix
|
121
|
+
case "#{PS_MULTI_HOME}"
|
122
|
+
when "false"
|
123
|
+
apps = do_cmd("find #{env('PS_CFG_HOME')}/appserv/*/psappsrv.ubx 2>/dev/null",false).split(/\n+/)
|
124
|
+
else
|
125
|
+
apps = do_cmd("find #{PS_MULTI_HOME}#{PS_MULTI_DELIMIT}*/appserv/*/psappsrv.ubx 2>/dev/null",false).split(/\n+/)
|
126
|
+
end
|
127
|
+
apps.map! {|app| app.split("/")[-2]}
|
128
|
+
end
|
129
|
+
|
130
|
+
def find_prcss_nix
|
131
|
+
case "#{PS_MULTI_HOME}"
|
132
|
+
when "false"
|
133
|
+
prcss = do_cmd("find #{env('PS_CFG_HOME')}/appserv/prcs/*/psprcsrv.ubx 2>/dev/null",false).split(/\n+/)
|
134
|
+
else
|
135
|
+
prcss = do_cmd("find #{PS_MULTI_HOME}#{PS_MULTI_DELIMIT}*/appserv/prcs/*/psprcsrv.ubx 2>/dev/null",false).split(/\n+/)
|
136
|
+
end
|
137
|
+
prcss.map! {|prcs| prcs.split("/")[-2]}
|
138
|
+
end
|
139
|
+
|
140
|
+
def find_webs_nix
|
141
|
+
case "#{PS_MULTI_HOME}"
|
142
|
+
when "false"
|
143
|
+
webs = do_cmd("find #{env('PS_CFG_HOME')}/webserv/*/piaconfig -maxdepth 0",false).split(/\n+/)
|
144
|
+
else
|
145
|
+
webs = do_cmd("find #{PS_MULTI_HOME}#{PS_MULTI_DELIMIT}*/webserv/*/piaconfig -maxdepth 0",false).split(/\n+/)
|
146
|
+
end
|
147
|
+
webs.map! {|web| web.split("/")[-2]}
|
148
|
+
end
|
149
|
+
|
150
|
+
def find_sites_nix(domain)
|
151
|
+
webs = do_cmd("find ${PS_CFG_HOME?}/webserv/#{domain}/applications/peoplesoft/PORTAL.war/WEB-INF/psftdocs/* -maxdepth 0",false).split(/\n+/)
|
152
|
+
webs.map! {|site| site.split("/")[-1]}
|
153
|
+
end
|
154
|
+
|
155
|
+
def find_apps_win
|
156
|
+
case "#{PS_MULTI_HOME}"
|
157
|
+
when "false"
|
158
|
+
apps = do_cmd("(get-childitem #{env('PS_CFG_HOME')}/appserv/*/psappsrv.ubx | Format-Table -property FullName -HideTableHeaders | Out-String).Trim()",false).split(/\n+/)
|
159
|
+
else
|
160
|
+
apps = do_cmd("(get-childitem #{PS_MULTI_HOME}#{PS_MULTI_DELIMIT}*/appserv/*/psappsrv.ubx | Format-Table -property FullName -HideTableHeaders | Out-String).Trim()",false).split(/\n+/)
|
161
|
+
end
|
162
|
+
apps.map! {|app| app.split('\\')[-2]}
|
163
|
+
end
|
164
|
+
|
165
|
+
def find_prcss_win
|
166
|
+
case "#{PS_MULTI_HOME}"
|
167
|
+
when "false"
|
168
|
+
prcss = do_cmd("(get-childitem #{env('PS_CFG_HOME')}/appserv/prcs/*/psprcsrv.ubx | Format-Table -property FullName -HideTableHeaders | Out-String).Trim()",false).split(/\n+/)
|
169
|
+
else
|
170
|
+
prcss = do_cmd("(get-childitem #{PS_MULTI_HOME}#{PS_MULTI_DELIMIT}*/appserv/prcs/*/psprcsrv.ubx | Format-Table -property FullName -HideTableHeaders | Out-String).Trim()",false).split(/\n+/)
|
171
|
+
end
|
172
|
+
prcss.map! {|prcs| prcs.split("\\")[-2]}
|
173
|
+
end
|
174
|
+
|
175
|
+
def find_webs_win
|
176
|
+
case "#{PS_MULTI_HOME}"
|
177
|
+
when "false"
|
178
|
+
webs = do_cmd("(get-childitem #{env('PS_CFG_HOME')}/webserv/*/piaconfig | Format-Table -property FullName -HideTableHeaders | Out-String).Trim()",false).split(/\n+/)
|
179
|
+
else
|
180
|
+
webs = do_cmd("(get-childitem #{PS_MULTI_HOME}#{PS_MULTI_DELIMIT}*/webserv/*/piaconfig | Format-Table -property FullName -HideTableHeaders | Out-String).Trim()",false).split(/\n+/)
|
181
|
+
end
|
182
|
+
webs.map! {|web| web.split("\\")[-2]}
|
183
|
+
end
|
184
|
+
|
185
|
+
def find_sites_win(domain)
|
186
|
+
#TODO
|
187
|
+
#sites = do_cmd("(get-childitem #{env('PS_CFG_HOME')}/webserv/#{domain}/applications/peoplesoft/PORTAL.war/WEB-INF/psftdocs | Format-Table -property FullName -HideTableHeaders | Out-String).Trim()",false).split(/\n+/)
|
188
|
+
#sites.map! {|site| site.split("\\")[-2]}
|
189
|
+
end
|
190
|
+
|
191
|
+
def find_apps
|
192
|
+
apps = "#{OS_CONST}" == "linux" ? find_apps_nix : find_apps_win
|
193
|
+
end
|
194
|
+
|
195
|
+
def find_prcss
|
196
|
+
prcss = "#{OS_CONST}" == "linux" ? find_prcss_nix : find_prcss_win
|
197
|
+
end
|
198
|
+
|
199
|
+
def find_webs
|
200
|
+
webs = "#{OS_CONST}" == "linux" ? find_webs_nix : find_webs_win
|
201
|
+
end
|
202
|
+
|
203
|
+
def find_sites(domain)
|
204
|
+
sites = "#{OS_CONST}" == "linux" ? find_sites_nix(domain) : find_sites_win(domain)
|
205
|
+
end
|
206
|
+
|
207
|
+
def do_util
|
208
|
+
puts "TODO: util"
|
209
|
+
end
|
210
|
+
|
211
|
+
def do_admin
|
212
|
+
do_cmd("#{PS_PSADMIN_PATH}/psadmin")
|
213
|
+
end
|
214
|
+
|
215
|
+
def do_list
|
216
|
+
puts "---"
|
217
|
+
print "hostname: " ; do_cmd('hostname')
|
218
|
+
print "ps-home: " ; do_cmd('echo ' + env('PS_HOME'))
|
219
|
+
if PS_MULTI_HOME == "false"
|
220
|
+
print "ps-cfg-home: " ; do_cmd('echo ' + env('PS_CFG_HOME'))
|
221
|
+
else
|
222
|
+
puts "ps-cfg-home base: #{PS_MULTI_HOME}#{PS_MULTI_DELIMIT}*"
|
223
|
+
end
|
224
|
+
puts ""
|
225
|
+
puts "PS_RUNTIME_USER: #{PS_RUNTIME_USER}"
|
226
|
+
puts "PS_PSA_SUDO: #{PS_PSA_SUDO}"
|
227
|
+
puts "PS_HOOK_INTERP: #{PS_HOOK_INTERP}"
|
228
|
+
puts "PS_HOOK_PRE: #{PS_HOOK_PRE}"
|
229
|
+
puts "PS_HOOK_POST: #{PS_HOOK_POST}"
|
230
|
+
puts "PS_HOOK_START: #{PS_HOOK_START}"
|
231
|
+
puts "PS_HOOK_STOP: #{PS_HOOK_STOP}"
|
232
|
+
puts "PS_WIN_SERVICES: #{PS_WIN_SERVICES}"
|
233
|
+
puts "PS_MULTI_HOME: #{PS_MULTI_HOME}"
|
234
|
+
puts "PS_PARALLEL_BOOT: #{PS_PARALLEL_BOOT}"
|
235
|
+
puts "PS_PSA_DEBUG: #{PS_PSA_DEBUG}"
|
236
|
+
puts ""
|
237
|
+
puts "app:"
|
238
|
+
find_apps.each do |a|
|
239
|
+
puts " - #{a}"
|
240
|
+
end
|
241
|
+
puts ""
|
242
|
+
puts "prcs:"
|
243
|
+
find_prcss.each do |p|
|
244
|
+
puts " - #{p}"
|
245
|
+
end
|
246
|
+
puts ""
|
247
|
+
puts "web:"
|
248
|
+
find_webs.each do |w|
|
249
|
+
puts " - #{w}"
|
250
|
+
end
|
251
|
+
puts ""
|
252
|
+
end
|
253
|
+
|
254
|
+
def do_psadmin_check
|
255
|
+
# Check to see if psadmin loads correctly
|
256
|
+
# This will help when used on web servers that don't have Tuxedo
|
257
|
+
case "#{PS_PSA_DEBUG}"
|
258
|
+
when "true"
|
259
|
+
puts "Checking psadmin version to validate configuration:"
|
260
|
+
check = do_cmd("#{PS_PSADMIN_PATH}/psadmin -v 2>&1",true)
|
261
|
+
else
|
262
|
+
check = do_cmd("#{PS_PSADMIN_PATH}/psadmin -v 2>&1",false)
|
263
|
+
end
|
264
|
+
if check.include? "error"
|
265
|
+
# psadmin config is NOT valid
|
266
|
+
puts "ERROR: psadmin is not configured correctly for this environment!"
|
267
|
+
puts " Some psadmin-plus actions only work when Tuxedo and psadmin are configured"
|
268
|
+
false
|
269
|
+
else
|
270
|
+
# psadmin config is valid
|
271
|
+
true
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
def do_summary
|
276
|
+
if "#{PS_MULTI_HOME}" != "false"
|
277
|
+
ENV['PS_CFG_HOME'] = "#{PS_MULTI_HOME}#{PS_MULTI_DELIMIT}#{domain}"
|
278
|
+
end
|
279
|
+
|
280
|
+
do_psadmin_check ? nil : exit
|
281
|
+
|
282
|
+
do_cmd("#{PS_PSADMIN_PATH}/psadmin -envsummary")
|
283
|
+
#do_status("web","all")
|
284
|
+
end
|
285
|
+
|
286
|
+
def do_status(type, domain)
|
287
|
+
case type
|
288
|
+
when "app"
|
289
|
+
do_psadmin_check ? nil : return
|
290
|
+
do_cmd("#{PS_PSADMIN_PATH}/psadmin -c sstatus -d #{domain}")
|
291
|
+
do_cmd("#{PS_PSADMIN_PATH}/psadmin -c cstatus -d #{domain}")
|
292
|
+
do_cmd("#{PS_PSADMIN_PATH}/psadmin -c qstatus -d #{domain}")
|
293
|
+
do_cmd("#{PS_PSADMIN_PATH}/psadmin -c pslist -d #{domain}")
|
294
|
+
when "pubsub"
|
295
|
+
ENV['TUXCONFIG'] = "#{ENV['PS_CFG_HOME']}/appserv/#{domain}/PSTUXCFG"
|
296
|
+
do_cmd("echo 'printserver -g PUBSUB' | #{ENV['TUXDIR']}/bin/tmadmin")
|
297
|
+
when "prcs"
|
298
|
+
do_psadmin_check ? nil : return
|
299
|
+
do_cmd("#{PS_PSADMIN_PATH}/psadmin -p status -d #{domain}")
|
300
|
+
when "web"
|
301
|
+
# TODO - PIA script status? 1. psadmin, 2. script, 3. lock file, 4. service
|
302
|
+
#do_psadmin_check ? nil : return
|
303
|
+
do_cmd("#{PS_PSADMIN_PATH}/psadmin -w status -d #{domain}")
|
304
|
+
#do_cmd("${PS_CFG_HOME?}/webserv/#{domain}/bin/singleserverStatus.sh")
|
305
|
+
#if File.exist?("#{ENV['PS_CFG_HOME']}/webserv/#{domain}/servers/PIA/tmp/PIA.lok")
|
306
|
+
else
|
307
|
+
puts "Invalid type, see psa help"
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
311
|
+
def do_start(type, domain)
|
312
|
+
web_service_name = ENV['WEB_SERVICE_NAME'] || "Psft*Pia*#{domain}*"
|
313
|
+
app_service_name = ENV['APP_SERVICE_NAME'] || "Psft*App*#{domain}*"
|
314
|
+
prcs_service_name = ENV['PRCS_SERVICE_NAME'] || "Psft*Prcs*#{domain}*"
|
315
|
+
|
316
|
+
case "#{PS_PARALLEL_BOOT}"
|
317
|
+
when "false"
|
318
|
+
start_app_cmd = "#{PS_PSADMIN_PATH}/psadmin -c boot -d #{domain}"
|
319
|
+
when "true"
|
320
|
+
start_app_cmd = "#{PS_PSADMIN_PATH}/psadmin -c parallelboot -d #{domain}"
|
321
|
+
end
|
322
|
+
start_app_service_cmd = "start-service #{app_service_name}"
|
323
|
+
start_prcs_cmd = "#{PS_PSADMIN_PATH}/psadmin -p start -d #{domain}"
|
324
|
+
start_prcs_service_cmd = "start-service #{prcs_service_name}"
|
325
|
+
start_web_cmd_lnx = "${PS_CFG_HOME?}/webserv/#{domain}/bin/startPIA.sh"
|
326
|
+
start_web_cmd_win = "#{PS_PSADMIN_PATH}/psadmin -w start -d #{domain}"
|
327
|
+
start_web_service_cmd = "start-service #{web_service_name}"
|
328
|
+
|
329
|
+
case type
|
330
|
+
when "app"
|
331
|
+
case "#{PS_WIN_SERVICES}"
|
332
|
+
when "true", "tux", "app", "all"
|
333
|
+
do_cmd(start_app_service_cmd)
|
334
|
+
else
|
335
|
+
do_cmd(start_app_cmd)
|
336
|
+
case "#{PS_TRAIL_SERVICE}"
|
337
|
+
when "true"
|
338
|
+
do_cmd(start_app_service_cmd)
|
339
|
+
end
|
340
|
+
end
|
341
|
+
do_hookstart("start",type,domain)
|
342
|
+
when "pubsub"
|
343
|
+
ENV['TUXCONFIG'] = "#{ENV['PS_CFG_HOME']}/appserv/#{domain}/PSTUXCFG"
|
344
|
+
do_cmd("echo 'boot -g PUBSUB' | #{ENV['TUXDIR']}/bin/tmadmin")
|
345
|
+
# do_hookstart("start",type,domain) - TODO skip hook for PUBSUB?
|
346
|
+
when "prcs"
|
347
|
+
case "#{PS_WIN_SERVICES}"
|
348
|
+
when "true", "tux", "prcs", "all"
|
349
|
+
do_cmd(start_prcs_service_cmd)
|
350
|
+
else
|
351
|
+
do_cmd(start_prcs_cmd)
|
352
|
+
case "#{PS_TRAIL_SERVICE}"
|
353
|
+
when "true"
|
354
|
+
do_cmd(start_prcs_service_cmd)
|
355
|
+
end
|
356
|
+
end
|
357
|
+
do_hookstart("start",type,domain)
|
358
|
+
when "web"
|
359
|
+
case "#{OS_CONST}"
|
360
|
+
when "linux"
|
361
|
+
if File.exist?("#{ENV['PS_CFG_HOME']}/webserv/#{domain}/servers/PIA/tmp/PIA.lok")
|
362
|
+
puts "Domain #{domain} already started"
|
363
|
+
else
|
364
|
+
do_cmd(start_web_cmd_lnx)
|
365
|
+
sleep 5.0
|
366
|
+
end
|
367
|
+
when "windows"
|
368
|
+
case "#{PS_WIN_SERVICES}"
|
369
|
+
when "true", "web", "all"
|
370
|
+
do_cmd(start_web_service_cmd)
|
371
|
+
else
|
372
|
+
# Run command outside of powershell with 'false' parameter
|
373
|
+
do_cmd(start_web_cmd_win, true, false)
|
374
|
+
case "#{PS_TRAIL_SERVICE}"
|
375
|
+
when "true", "web", "all"
|
376
|
+
do_cmd(start_web_service_cmd)
|
377
|
+
end
|
378
|
+
end
|
379
|
+
end
|
380
|
+
do_hookstart("start",type,domain)
|
381
|
+
else
|
382
|
+
puts "Invalid type, see psa help"
|
383
|
+
end
|
384
|
+
end
|
385
|
+
|
386
|
+
def do_stop(type, domain)
|
387
|
+
web_service_name = ENV['WEB_SERVICE_NAME'] || "Psft*Pia*#{domain}*"
|
388
|
+
app_service_name = ENV['APP_SERVICE_NAME'] || "Psft*App*#{domain}*"
|
389
|
+
prcs_service_name = ENV['PRCS_SERVICE_NAME'] || "Psft*Prcs*#{domain}*"
|
390
|
+
|
391
|
+
stop_app_cmd = "#{PS_PSADMIN_PATH}/psadmin -c shutdown -d #{domain}"
|
392
|
+
stop_app_service_cmd = "stop-service #{app_service_name}"
|
393
|
+
stop_prcs_cmd = "#{PS_PSADMIN_PATH}/psadmin -p stop -d #{domain}"
|
394
|
+
stop_prcs_service_cmd = "stop-service #{prcs_service_name}"
|
395
|
+
stop_web_cmd_lnx = "${PS_CFG_HOME?}/webserv/#{domain}/bin/stopPIA.sh"
|
396
|
+
stop_web_cmd_win = "#{PS_PSADMIN_PATH}/psadmin -w shutdown -d #{domain}"
|
397
|
+
stop_web_service_cmd = "stop-service #{web_service_name}"
|
398
|
+
|
399
|
+
case type
|
400
|
+
when "app"
|
401
|
+
do_hookstop("stop",type,domain)
|
402
|
+
case "#{PS_WIN_SERVICES}"
|
403
|
+
when "true"
|
404
|
+
do_cmd(stop_app_service_cmd)
|
405
|
+
else
|
406
|
+
do_cmd(stop_app_cmd)
|
407
|
+
case "#{PS_TRAIL_SERVICE}"
|
408
|
+
when "true"
|
409
|
+
do_cmd(stop_app_service_cmd)
|
410
|
+
end
|
411
|
+
end
|
412
|
+
when "pubsub"
|
413
|
+
# do_hookstop("stop",type,domain) - TODO skip hook for PUBSUB?
|
414
|
+
ENV['TUXCONFIG'] = "#{ENV['PS_CFG_HOME']}/appserv/#{domain}/PSTUXCFG"
|
415
|
+
do_cmd("echo 'shutdown -g PUBSUB' | #{ENV['TUXDIR']}/bin/tmadmin")
|
416
|
+
when "prcs"
|
417
|
+
do_hookstop("stop",type,domain)
|
418
|
+
case "#{PS_WIN_SERVICES}"
|
419
|
+
when "true"
|
420
|
+
do_cmd(stop_prcs_service_cmd)
|
421
|
+
else
|
422
|
+
do_cmd(stop_prcs_cmd)
|
423
|
+
case "#{PS_TRAIL_SERVICE}"
|
424
|
+
when "true"
|
425
|
+
do_cmd(stop_prcs_service_cmd)
|
426
|
+
end
|
427
|
+
end
|
428
|
+
when "web"
|
429
|
+
do_hookstop("stop",type,domain)
|
430
|
+
case "#{OS_CONST}"
|
431
|
+
when "linux"
|
432
|
+
do_cmd(stop_web_cmd_lnx)
|
433
|
+
when "windows"
|
434
|
+
case "#{PS_WIN_SERVICES}"
|
435
|
+
when "true"
|
436
|
+
do_cmd(stop_web_service_cmd)
|
437
|
+
else
|
438
|
+
do_cmd(stop_web_cmd_win, true, false)
|
439
|
+
case "#{PS_TRAIL_SERVICE}"
|
440
|
+
when "true"
|
441
|
+
do_cmd(stop_web_service_cmd)
|
442
|
+
end
|
443
|
+
end
|
444
|
+
end
|
445
|
+
else
|
446
|
+
puts "Invalid type, see psa help"
|
447
|
+
end
|
448
|
+
end
|
449
|
+
|
450
|
+
def do_kill(type, domain)
|
451
|
+
case type
|
452
|
+
when "app"
|
453
|
+
do_cmd("#{PS_PSADMIN_PATH}/psadmin -c shutdown! -d #{domain}")
|
454
|
+
when "prcs"
|
455
|
+
do_cmd("#{PS_PSADMIN_PATH}/psadmin -p kill -d #{domain}")
|
456
|
+
when "web"
|
457
|
+
case "#{OS_CONST}"
|
458
|
+
when "windows"
|
459
|
+
do_cmd("(gwmi win32_process | where {$_.Name -eq 'Java.exe'} | where {$_.CommandLine -match '#{domain}'}).ProcessId -ErrorAction SilentlyContinue | % { stop-process $_ -force } -ErrorAction SilentlyContinue")
|
460
|
+
when "linux"
|
461
|
+
do_cmd("kill $(ps aux|grep java|grep ${PS_CFG_HOME?}/webserv/#{domain}/piaconfig|awk ' {print $2}')")
|
462
|
+
end
|
463
|
+
else
|
464
|
+
puts "Invalid type, see psa help"
|
465
|
+
end
|
466
|
+
end
|
467
|
+
|
468
|
+
def do_configure(type, domain)
|
469
|
+
case type
|
470
|
+
when "app"
|
471
|
+
do_cmd("#{PS_PSADMIN_PATH}/psadmin -c configure -d #{domain}")
|
472
|
+
when "prcs"
|
473
|
+
do_cmd("#{PS_PSADMIN_PATH}/psadmin -p configure -d #{domain}")
|
474
|
+
when "web"
|
475
|
+
do_webprof_reload("#{domain}")
|
476
|
+
else
|
477
|
+
puts "Invalid type, see psa help"
|
478
|
+
end
|
479
|
+
end
|
480
|
+
|
481
|
+
def do_purge(type, domain)
|
482
|
+
case type
|
483
|
+
when "app"
|
484
|
+
do_cmd("#{PS_PSADMIN_PATH}/psadmin -c purge -d #{domain}")
|
485
|
+
when "prcs"
|
486
|
+
do_cmd("echo Purge currently does nothing for prcs")
|
487
|
+
when "web"
|
488
|
+
case "#{OS_CONST}"
|
489
|
+
when "linux"
|
490
|
+
do_cmd("rm -rf ${PS_CFG_HOME?}/webserv/#{domain}/applications/peoplesoft/PORTAL*/*/cache*/")
|
491
|
+
puts "web cache purged"
|
492
|
+
when "windows"
|
493
|
+
do_cmd("Remove-Item $(Get-ChildItem ${env:PS_CFG_HOME}/webserv/#{domain}/applications/peoplesoft/PORTAL*/*/cache*/ | ?{ $_.PSIsContainer}) -recurse -force -ErrorAction SilentlyContinue".gsub('/','\\'))
|
494
|
+
end
|
495
|
+
else
|
496
|
+
puts "Invalid type, see psa help"
|
497
|
+
end
|
498
|
+
end
|
499
|
+
|
500
|
+
def do_flush(type, domain)
|
501
|
+
case type
|
502
|
+
when "app"
|
503
|
+
do_cmd("#{PS_PSADMIN_PATH}/psadmin -c cleanipc -d #{domain}")
|
504
|
+
when "prcs"
|
505
|
+
do_cmd("#{PS_PSADMIN_PATH}/psadmin -p cleanipc -d #{domain}")
|
506
|
+
when "web"
|
507
|
+
return # web flush n/a
|
508
|
+
else
|
509
|
+
puts "Invalid type, see psa help"
|
510
|
+
end
|
511
|
+
end
|
512
|
+
|
513
|
+
def do_restart(type, domain)
|
514
|
+
do_stop(type, domain)
|
515
|
+
do_start(type, domain)
|
516
|
+
end
|
517
|
+
|
518
|
+
def do_reconfigure(type, domain)
|
519
|
+
do_stop(type, domain)
|
520
|
+
do_configure(type, domain)
|
521
|
+
do_start(type, domain)
|
522
|
+
end
|
523
|
+
|
524
|
+
def do_bounce(type, domain)
|
525
|
+
do_stop(type, domain)
|
526
|
+
do_purge(type, domain)
|
527
|
+
do_flush(type, domain)
|
528
|
+
do_configure(type, domain)
|
529
|
+
do_start(type, domain)
|
530
|
+
end
|
531
|
+
|
532
|
+
def do_hook(command, type, domain, script)
|
533
|
+
ENV['PSA_CMD'] = command
|
534
|
+
ENV['PSA_TYPE'] = type
|
535
|
+
ENV['PSA_DOMAIN'] = domain
|
536
|
+
out = `#{PS_HOOK_INTERP} #{script}`
|
537
|
+
puts out
|
538
|
+
end
|
539
|
+
|
540
|
+
def do_hookpre(command, type, domain)
|
541
|
+
if "#{PS_HOOK_PRE}" != "false"
|
542
|
+
"#{PS_PSA_DEBUG}" == "true" ? (puts "Executing domain pre command hook...\n\n") : nil
|
543
|
+
do_hook(command, type, domain, PS_HOOK_PRE)
|
544
|
+
"#{PS_PSA_DEBUG}" == "true" ? (puts "\n...hook done") : nil
|
545
|
+
end
|
546
|
+
end
|
547
|
+
|
548
|
+
def do_hookpost(command, type, domain)
|
549
|
+
if "#{PS_HOOK_POST}" != "false"
|
550
|
+
"#{PS_PSA_DEBUG}" == "true" ? (puts "Executing domain post command hook...\n\n") : nil
|
551
|
+
do_hook(command, type, domain, PS_HOOK_POST)
|
552
|
+
"#{PS_PSA_DEBUG}" == "true" ? (puts "\n...hook done") : nil
|
553
|
+
end
|
554
|
+
end
|
555
|
+
|
556
|
+
def do_hookstart(command, type, domain)
|
557
|
+
if "#{PS_HOOK_START}" != "false"
|
558
|
+
"#{PS_PSA_DEBUG}" == "true" ? (puts "Executing domain start hook...\n\n") : nil
|
559
|
+
do_hook(command, type, domain, PS_HOOK_START)
|
560
|
+
"#{PS_PSA_DEBUG}" == "true" ? (puts "\n...hook done") : nil
|
561
|
+
end
|
562
|
+
end
|
563
|
+
|
564
|
+
def do_hookstop(command, type, domain)
|
565
|
+
if "#{PS_HOOK_STOP}" != "false"
|
566
|
+
"#{PS_PSA_DEBUG}" == "true" ? (puts "Executing domain stop hook...\n\n") : nil
|
567
|
+
do_hook(command, type, domain, PS_HOOK_STOP)
|
568
|
+
"#{PS_PSA_DEBUG}" == "true" ? (puts "\n...hook done") : nil
|
569
|
+
end
|
570
|
+
end
|
571
|
+
|
572
|
+
def do_webprof_reload(domain)
|
573
|
+
puts "Reloading Web Profiles"
|
574
|
+
|
575
|
+
case "#{OS_CONST}"
|
576
|
+
when "linux"
|
577
|
+
"#{PS_PSA_DEBUG}" == "true" ? show_debug = true : show_debug = false
|
578
|
+
|
579
|
+
find_sites(domain).each do |s|
|
580
|
+
# set vars
|
581
|
+
url = "${ADMINSERVER_PROTOCOL?}://${ADMINSERVER_HOSTNAME?}:${ADMINSERVER_PORT?}/psp/#{s}/?cmd=login&"
|
582
|
+
src_env = ". ${PS_CFG_HOME?}/webserv/#{domain}/bin/setEnv.sh"
|
583
|
+
prop_file = "${PS_CFG_HOME?}/webserv/#{domain}/applications/peoplesoft/PORTAL.war/WEB-INF/psftdocs/#{s}/configuration.properties"
|
584
|
+
|
585
|
+
# set reload in config.props
|
586
|
+
do_cmd("sed -i 's/ReloadWebProfileWithoutRestart=.*/ReloadWebProfileWithoutRestart=1/g' #{prop_file}",show_debug)
|
587
|
+
|
588
|
+
# source setEnv and ping site
|
589
|
+
show_debug ? do_cmd("#{src_env} ; curl -s #{url}",show_debug) : do_cmd("#{src_env} ; curl -s -o /dev/null #{url}",show_debug)
|
590
|
+
|
591
|
+
# unset reload in config.props
|
592
|
+
do_cmd("sed -i 's/ReloadWebProfileWithoutRestart=.*/ReloadWebProfileWithoutRestart=0/g' #{prop_file}",show_debug)
|
593
|
+
|
594
|
+
# done
|
595
|
+
puts " - #{s}"
|
596
|
+
end
|
597
|
+
when "windows"
|
598
|
+
puts "Windows support coming soon."
|
599
|
+
#do_cmd(". #{env('PS_CFG_HOME')}/webserv/#{domain}/bin/setEnv.sh")
|
600
|
+
|
601
|
+
#find_sites.each do |s|
|
602
|
+
# # set vars
|
603
|
+
# prop_file = "#{env('PS_CFG_HOME')}/webserv/#{domain}/applications/peoplesoft/PORTAL.war/WEB-INF/psftdocs/#{s}}/configuration.properties"
|
604
|
+
# url = "http://#{PS_PIA_HOST}.#{PS_PIA_DOMAIN}:#{PS_PIA_PORT}/psp/#{s}/?cmd=login&"
|
605
|
+
# # set reload in config.props
|
606
|
+
# do_cmd("sed -i 's/ReloadWebProfileWithoutRestart=.*/ReloadWebProfileWithoutRestart=1/g' #{prop_file}")
|
607
|
+
# # ping site
|
608
|
+
# do_cmd("curl -s -o /dev/null '#{url}'")
|
609
|
+
# # unset reload in config.props
|
610
|
+
# do_cmd("sed -i 's/ReloadWebProfileWithoutRestart=.*/ReloadWebProfileWithoutRestart=0/g' #{prop_file}")
|
611
|
+
# # done
|
612
|
+
# puts " - #{s}"
|
613
|
+
#end
|
614
|
+
else
|
615
|
+
puts " badOS - #{OS_CONST}"
|
616
|
+
end
|
617
|
+
puts ""
|
618
|
+
end
|
619
|
+
|
620
|
+
def os
|
621
|
+
@os ||= (
|
622
|
+
host_os = RbConfig::CONFIG['host_os']
|
623
|
+
case host_os
|
624
|
+
when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
|
625
|
+
:windows
|
626
|
+
when /darwin|mac os/
|
627
|
+
:macosx
|
628
|
+
when /linux/
|
629
|
+
:linux
|
630
|
+
when /solaris|bsd/
|
631
|
+
:unix
|
632
|
+
else
|
633
|
+
raise Error::WebDriverError, "unknown os: #{host_os.inspect}"
|
634
|
+
end
|
635
|
+
)
|
636
|
+
end
|