psadmin_plus 2.0.4 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/psa +81 -57
- data/lib/psadmin_plus.rb +187 -82
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e0a6c139d1425345320bc485e585220c72dee5d2c17fa440a7de6c2eeb4f2cd
|
4
|
+
data.tar.gz: 3a595352998f4c045cab27803e1af1a4266c5823cc177a0f8360716003e859bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28679fd69d09d403a61be342ac8eefb16e68e2fcaa2641869f7b180ca3bd98df1a82341e7c4b55994f93cbf96d6cf5d5f6fd532ea89e0c4d011b1d6c8ec45fc2
|
7
|
+
data.tar.gz: be5c3f5003bf45bf6566522041ff6996219b9aba7b8c0eea0977a1c1d50de1350e2a69009964cbf6c909cadf34dbd27a655395dc11f2e6d0620322606ee7362f
|
data/bin/psa
CHANGED
@@ -1,12 +1,26 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
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
|
4
9
|
|
5
10
|
# options
|
6
11
|
opts_c = ARGV.shift || "help"
|
7
12
|
opts_t = ARGV.shift || "all"
|
8
13
|
opts_d = ARGV.shift || "all"
|
9
|
-
|
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
|
10
24
|
|
11
25
|
commands = opts_c.split(',')
|
12
26
|
types = opts_t.split(',')
|
@@ -15,8 +29,6 @@ domains = opts_d.split(',')
|
|
15
29
|
if types.include? "all" then types = ['app','prcs','web'] end
|
16
30
|
if domains.include? "all" then all_domains = true end
|
17
31
|
|
18
|
-
|
19
|
-
|
20
32
|
# setup environment
|
21
33
|
PS_PSA_CONF = ENV['PS_PSA_CONF'] || "#{ENV['HOME']}/.psa.conf"
|
22
34
|
if File.exists?(PS_PSA_CONF) then
|
@@ -25,7 +37,7 @@ if File.exists?(PS_PSA_CONF) then
|
|
25
37
|
next
|
26
38
|
else
|
27
39
|
key, value = line.split "="
|
28
|
-
ENV[key] = value.strip
|
40
|
+
value.nil? ? next : ENV[key] = value.strip
|
29
41
|
end
|
30
42
|
end
|
31
43
|
end
|
@@ -33,15 +45,18 @@ end
|
|
33
45
|
# constants
|
34
46
|
OS_CONST = os
|
35
47
|
PS_RUNTIME_USER = ENV['PS_RUNTIME_USER'] || "psadm2"
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
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"
|
40
53
|
PS_PSA_SUDO = ENV['PS_PSA_SUDO'] || "on"
|
41
54
|
PS_PSADMIN_PATH = "#{OS_CONST}" == "linux" ? "#{env('PS_HOME')}/bin" : "cmd /c #{env('PS_HOME')}/appserv"
|
42
55
|
PS_WIN_SERVICES = ENV['PS_WIN_SERVICES'] || "false"
|
43
56
|
PS_TRAIL_SERVICE = ENV['PS_TRAIL_SERVICE'] || "false"
|
44
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
|
45
60
|
PS_PARALLEL_BOOT = ENV['PS_PARALLEL_BOOT'] || "false"
|
46
61
|
PS_PSA_DEBUG = ENV['PS_PSA_DEBUG'] || "false"
|
47
62
|
|
@@ -71,60 +86,69 @@ commands.each do |c|
|
|
71
86
|
do_summary
|
72
87
|
else
|
73
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
|
+
|
74
101
|
if all_domains then
|
75
|
-
|
76
|
-
when "app"
|
77
|
-
domains = find_apps
|
78
|
-
when "prcs"
|
79
|
-
domains = find_prcss
|
80
|
-
when "web"
|
81
|
-
domains = find_webs
|
82
|
-
end
|
102
|
+
domains = valid_domains
|
83
103
|
end
|
104
|
+
|
84
105
|
domains.each do |d|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
when "stop"
|
93
|
-
do_cmd_banner(c,t,d)
|
94
|
-
do_stop(t,d)
|
95
|
-
when "kill"
|
96
|
-
do_cmd_banner(c,t,d)
|
97
|
-
do_kill(t,d)
|
98
|
-
when "configure"
|
99
|
-
do_cmd_banner(c,t,d)
|
100
|
-
do_configure(t,d)
|
101
|
-
when "reconfigure"
|
102
|
-
do_cmd_banner(c,t,d)
|
103
|
-
do_reconfigure(t,d)
|
104
|
-
when "purge"
|
105
|
-
do_cmd_banner(c,t,d)
|
106
|
-
do_purge(t,d)
|
107
|
-
when "flush"
|
108
|
-
do_cmd_banner(c,t,d)
|
109
|
-
do_flush(t,d)
|
110
|
-
when "restart"
|
111
|
-
do_cmd_banner(c,t,d)
|
112
|
-
do_restart(t,d)
|
113
|
-
when "bounce"
|
114
|
-
do_cmd_banner(c,t,d)
|
115
|
-
do_bounce(t,d)
|
116
|
-
when "pooladd"
|
117
|
-
if t == "web"
|
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"
|
118
113
|
do_cmd_banner(c,t,d)
|
119
|
-
|
120
|
-
|
121
|
-
when "poolrm"
|
122
|
-
if t == "web"
|
114
|
+
do_status(t,d)
|
115
|
+
when "start"
|
123
116
|
do_cmd_banner(c,t,d)
|
124
|
-
|
125
|
-
|
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)
|
126
147
|
else
|
127
|
-
|
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
|
128
152
|
end
|
129
153
|
end
|
130
154
|
end
|
data/lib/psadmin_plus.rb
CHANGED
@@ -14,8 +14,8 @@ def do_help
|
|
14
14
|
#puts " admin launch psadmin"
|
15
15
|
puts " summary PS_CFG_HOME summary, no type or domain needed"
|
16
16
|
puts " status status of the domain"
|
17
|
-
puts " start
|
18
|
-
puts " stop
|
17
|
+
puts " start hookstart, if enabled, then start the domain"
|
18
|
+
puts " stop hookstop, if enabled, stop the domain"
|
19
19
|
puts " restart stop and start the domain"
|
20
20
|
puts " purge clear domain cache"
|
21
21
|
puts " reconfigure stop, configure, and start the domain"
|
@@ -23,15 +23,14 @@ def do_help
|
|
23
23
|
puts " kill force stop the domain"
|
24
24
|
puts " configure configure the domain"
|
25
25
|
puts " flush clear domain IPC"
|
26
|
-
puts " poolrm remove domain from load balanced pool "
|
27
|
-
puts " pooladd add domain to load balanced pool "
|
28
26
|
puts " "
|
29
27
|
puts "Types:"
|
30
28
|
puts " "
|
31
29
|
puts " app act on application domains"
|
30
|
+
#puts " pubsub act on PUBSUB group of application domains"
|
32
31
|
puts " prcs act on process scheduler domains"
|
33
32
|
puts " web act on web domains"
|
34
|
-
puts " all,<blank> act on
|
33
|
+
puts " all,<blank> act on web, app, and prcs domains"
|
35
34
|
puts " "
|
36
35
|
puts "Domains:"
|
37
36
|
puts " "
|
@@ -103,15 +102,27 @@ end
|
|
103
102
|
|
104
103
|
def do_cmd_banner(c,t,d)
|
105
104
|
puts ""
|
106
|
-
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
|
107
118
|
end
|
108
119
|
|
109
120
|
def find_apps_nix
|
110
121
|
case "#{PS_MULTI_HOME}"
|
111
122
|
when "false"
|
112
|
-
apps = do_cmd("find #{env('PS_CFG_HOME')}/appserv/*/psappsrv.ubx",false).split(/\n+/)
|
123
|
+
apps = do_cmd("find #{env('PS_CFG_HOME')}/appserv/*/psappsrv.ubx 2>/dev/null",false).split(/\n+/)
|
113
124
|
else
|
114
|
-
apps = do_cmd("find #{PS_MULTI_HOME}
|
125
|
+
apps = do_cmd("find #{PS_MULTI_HOME}#{PS_MULTI_DELIMIT}*/appserv/*/psappsrv.ubx 2>/dev/null",false).split(/\n+/)
|
115
126
|
end
|
116
127
|
apps.map! {|app| app.split("/")[-2]}
|
117
128
|
end
|
@@ -119,9 +130,9 @@ end
|
|
119
130
|
def find_prcss_nix
|
120
131
|
case "#{PS_MULTI_HOME}"
|
121
132
|
when "false"
|
122
|
-
prcss = do_cmd("find #{env('PS_CFG_HOME')}/appserv/prcs/*/psprcsrv.ubx",false).split(/\n+/)
|
133
|
+
prcss = do_cmd("find #{env('PS_CFG_HOME')}/appserv/prcs/*/psprcsrv.ubx 2>/dev/null",false).split(/\n+/)
|
123
134
|
else
|
124
|
-
prcss = do_cmd("find #{PS_MULTI_HOME}
|
135
|
+
prcss = do_cmd("find #{PS_MULTI_HOME}#{PS_MULTI_DELIMIT}*/appserv/prcs/*/psprcsrv.ubx 2>/dev/null",false).split(/\n+/)
|
125
136
|
end
|
126
137
|
prcss.map! {|prcs| prcs.split("/")[-2]}
|
127
138
|
end
|
@@ -131,17 +142,22 @@ def find_webs_nix
|
|
131
142
|
when "false"
|
132
143
|
webs = do_cmd("find #{env('PS_CFG_HOME')}/webserv/*/piaconfig -maxdepth 0",false).split(/\n+/)
|
133
144
|
else
|
134
|
-
webs = do_cmd("find #{PS_MULTI_HOME}
|
145
|
+
webs = do_cmd("find #{PS_MULTI_HOME}#{PS_MULTI_DELIMIT}*/webserv/*/piaconfig -maxdepth 0",false).split(/\n+/)
|
135
146
|
end
|
136
147
|
webs.map! {|web| web.split("/")[-2]}
|
137
148
|
end
|
138
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
|
+
|
139
155
|
def find_apps_win
|
140
156
|
case "#{PS_MULTI_HOME}"
|
141
157
|
when "false"
|
142
158
|
apps = do_cmd("(get-childitem #{env('PS_CFG_HOME')}/appserv/*/psappsrv.ubx | Format-Table -property FullName -HideTableHeaders | Out-String).Trim()",false).split(/\n+/)
|
143
159
|
else
|
144
|
-
apps = do_cmd("(get-childitem #{PS_MULTI_HOME}
|
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+/)
|
145
161
|
end
|
146
162
|
apps.map! {|app| app.split('\\')[-2]}
|
147
163
|
end
|
@@ -151,7 +167,7 @@ def find_prcss_win
|
|
151
167
|
when "false"
|
152
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+/)
|
153
169
|
else
|
154
|
-
prcss = do_cmd("(get-childitem #{PS_MULTI_HOME}
|
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+/)
|
155
171
|
end
|
156
172
|
prcss.map! {|prcs| prcs.split("\\")[-2]}
|
157
173
|
end
|
@@ -161,11 +177,17 @@ def find_webs_win
|
|
161
177
|
when "false"
|
162
178
|
webs = do_cmd("(get-childitem #{env('PS_CFG_HOME')}/webserv/*/piaconfig | Format-Table -property FullName -HideTableHeaders | Out-String).Trim()",false).split(/\n+/)
|
163
179
|
else
|
164
|
-
webs = do_cmd("(get-childitem #{PS_MULTI_HOME}
|
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+/)
|
165
181
|
end
|
166
182
|
webs.map! {|web| web.split("\\")[-2]}
|
167
183
|
end
|
168
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
|
+
|
169
191
|
def find_apps
|
170
192
|
apps = "#{OS_CONST}" == "linux" ? find_apps_nix : find_apps_win
|
171
193
|
end
|
@@ -178,6 +200,10 @@ def find_webs
|
|
178
200
|
webs = "#{OS_CONST}" == "linux" ? find_webs_nix : find_webs_win
|
179
201
|
end
|
180
202
|
|
203
|
+
def find_sites(domain)
|
204
|
+
sites = "#{OS_CONST}" == "linux" ? find_sites_nix(domain) : find_sites_win(domain)
|
205
|
+
end
|
206
|
+
|
181
207
|
def do_util
|
182
208
|
puts "TODO: util"
|
183
209
|
end
|
@@ -191,17 +217,20 @@ def do_list
|
|
191
217
|
print "hostname: " ; do_cmd('hostname')
|
192
218
|
print "ps-home: " ; do_cmd('echo ' + env('PS_HOME'))
|
193
219
|
if PS_MULTI_HOME == "false"
|
194
|
-
print "ps-cfg-home:
|
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}*"
|
195
223
|
end
|
196
224
|
puts ""
|
197
225
|
puts "PS_RUNTIME_USER: #{PS_RUNTIME_USER}"
|
198
226
|
puts "PS_PSA_SUDO: #{PS_PSA_SUDO}"
|
199
|
-
puts "
|
200
|
-
puts "
|
201
|
-
puts "
|
202
|
-
puts "
|
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}"
|
203
232
|
puts "PS_WIN_SERVICES: #{PS_WIN_SERVICES}"
|
204
|
-
puts "
|
233
|
+
puts "PS_MULTI_HOME: #{PS_MULTI_HOME}"
|
205
234
|
puts "PS_PARALLEL_BOOT: #{PS_PARALLEL_BOOT}"
|
206
235
|
puts "PS_PSA_DEBUG: #{PS_PSA_DEBUG}"
|
207
236
|
puts ""
|
@@ -222,40 +251,64 @@ def do_list
|
|
222
251
|
puts ""
|
223
252
|
end
|
224
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
|
+
|
225
275
|
def do_summary
|
226
276
|
if "#{PS_MULTI_HOME}" != "false"
|
227
|
-
ENV['PS_CFG_HOME'] = "#{PS_MULTI_HOME}
|
277
|
+
ENV['PS_CFG_HOME'] = "#{PS_MULTI_HOME}#{PS_MULTI_DELIMIT}#{domain}"
|
228
278
|
end
|
229
279
|
|
280
|
+
do_psadmin_check ? nil : exit
|
281
|
+
|
230
282
|
do_cmd("#{PS_PSADMIN_PATH}/psadmin -envsummary")
|
231
283
|
#do_status("web","all")
|
232
284
|
end
|
233
285
|
|
234
|
-
def do_status(type, domain)
|
235
|
-
if "#{PS_MULTI_HOME}" != "false"
|
236
|
-
ENV['PS_CFG_HOME'] = "#{PS_MULTI_HOME}/#{domain}"
|
237
|
-
end
|
238
|
-
|
286
|
+
def do_status(type, domain)
|
239
287
|
case type
|
240
288
|
when "app"
|
289
|
+
do_psadmin_check ? nil : return
|
241
290
|
do_cmd("#{PS_PSADMIN_PATH}/psadmin -c sstatus -d #{domain}")
|
242
291
|
do_cmd("#{PS_PSADMIN_PATH}/psadmin -c cstatus -d #{domain}")
|
243
292
|
do_cmd("#{PS_PSADMIN_PATH}/psadmin -c qstatus -d #{domain}")
|
244
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")
|
245
297
|
when "prcs"
|
298
|
+
do_psadmin_check ? nil : return
|
246
299
|
do_cmd("#{PS_PSADMIN_PATH}/psadmin -p status -d #{domain}")
|
247
300
|
when "web"
|
301
|
+
# TODO - PIA script status? 1. psadmin, 2. script, 3. lock file, 4. service
|
302
|
+
#do_psadmin_check ? nil : return
|
248
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")
|
249
306
|
else
|
250
307
|
puts "Invalid type, see psa help"
|
251
308
|
end
|
252
309
|
end
|
253
310
|
|
254
311
|
def do_start(type, domain)
|
255
|
-
if "#{PS_MULTI_HOME}" != "false"
|
256
|
-
ENV['PS_CFG_HOME'] = "#{PS_MULTI_HOME}/#{domain}"
|
257
|
-
end
|
258
|
-
|
259
312
|
web_service_name = ENV['WEB_SERVICE_NAME'] || "Psft*Pia*#{domain}*"
|
260
313
|
app_service_name = ENV['APP_SERVICE_NAME'] || "Psft*App*#{domain}*"
|
261
314
|
prcs_service_name = ENV['PRCS_SERVICE_NAME'] || "Psft*Prcs*#{domain}*"
|
@@ -273,7 +326,6 @@ def do_start(type, domain)
|
|
273
326
|
start_web_cmd_win = "#{PS_PSADMIN_PATH}/psadmin -w start -d #{domain}"
|
274
327
|
start_web_service_cmd = "start-service #{web_service_name}"
|
275
328
|
|
276
|
-
# 10-08-2020 Dale Haman: Changing the logic used on PS_WIN_SERVICES, it will never be tux, app or all.
|
277
329
|
case type
|
278
330
|
when "app"
|
279
331
|
case "#{PS_WIN_SERVICES}"
|
@@ -286,6 +338,11 @@ def do_start(type, domain)
|
|
286
338
|
do_cmd(start_app_service_cmd)
|
287
339
|
end
|
288
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?
|
289
346
|
when "prcs"
|
290
347
|
case "#{PS_WIN_SERVICES}"
|
291
348
|
when "true", "tux", "prcs", "all"
|
@@ -297,6 +354,7 @@ def do_start(type, domain)
|
|
297
354
|
do_cmd(start_prcs_service_cmd)
|
298
355
|
end
|
299
356
|
end
|
357
|
+
do_hookstart("start",type,domain)
|
300
358
|
when "web"
|
301
359
|
case "#{OS_CONST}"
|
302
360
|
when "linux"
|
@@ -319,17 +377,13 @@ def do_start(type, domain)
|
|
319
377
|
end
|
320
378
|
end
|
321
379
|
end
|
322
|
-
|
380
|
+
do_hookstart("start",type,domain)
|
323
381
|
else
|
324
382
|
puts "Invalid type, see psa help"
|
325
383
|
end
|
326
384
|
end
|
327
385
|
|
328
|
-
def do_stop(type, domain)
|
329
|
-
if "#{PS_MULTI_HOME}" != "false"
|
330
|
-
ENV['PS_CFG_HOME'] = "#{PS_MULTI_HOME}/#{domain}"
|
331
|
-
end
|
332
|
-
|
386
|
+
def do_stop(type, domain)
|
333
387
|
web_service_name = ENV['WEB_SERVICE_NAME'] || "Psft*Pia*#{domain}*"
|
334
388
|
app_service_name = ENV['APP_SERVICE_NAME'] || "Psft*App*#{domain}*"
|
335
389
|
prcs_service_name = ENV['PRCS_SERVICE_NAME'] || "Psft*Prcs*#{domain}*"
|
@@ -344,6 +398,7 @@ def do_stop(type, domain)
|
|
344
398
|
|
345
399
|
case type
|
346
400
|
when "app"
|
401
|
+
do_hookstop("stop",type,domain)
|
347
402
|
case "#{PS_WIN_SERVICES}"
|
348
403
|
when "true"
|
349
404
|
do_cmd(stop_app_service_cmd)
|
@@ -354,7 +409,12 @@ def do_stop(type, domain)
|
|
354
409
|
do_cmd(stop_app_service_cmd)
|
355
410
|
end
|
356
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")
|
357
416
|
when "prcs"
|
417
|
+
do_hookstop("stop",type,domain)
|
358
418
|
case "#{PS_WIN_SERVICES}"
|
359
419
|
when "true"
|
360
420
|
do_cmd(stop_prcs_service_cmd)
|
@@ -366,7 +426,7 @@ def do_stop(type, domain)
|
|
366
426
|
end
|
367
427
|
end
|
368
428
|
when "web"
|
369
|
-
|
429
|
+
do_hookstop("stop",type,domain)
|
370
430
|
case "#{OS_CONST}"
|
371
431
|
when "linux"
|
372
432
|
do_cmd(stop_web_cmd_lnx)
|
@@ -388,10 +448,6 @@ def do_stop(type, domain)
|
|
388
448
|
end
|
389
449
|
|
390
450
|
def do_kill(type, domain)
|
391
|
-
if "#{PS_MULTI_HOME}" != "false"
|
392
|
-
ENV['PS_CFG_HOME'] = "#{PS_MULTI_HOME}/#{domain}"
|
393
|
-
end
|
394
|
-
|
395
451
|
case type
|
396
452
|
when "app"
|
397
453
|
do_cmd("#{PS_PSADMIN_PATH}/psadmin -c shutdown! -d #{domain}")
|
@@ -402,7 +458,7 @@ def do_kill(type, domain)
|
|
402
458
|
when "windows"
|
403
459
|
do_cmd("(gwmi win32_process | where {$_.Name -eq 'Java.exe'} | where {$_.CommandLine -match '#{domain}'}).ProcessId -ErrorAction SilentlyContinue | % { stop-process $_ -force } -ErrorAction SilentlyContinue")
|
404
460
|
when "linux"
|
405
|
-
|
461
|
+
do_cmd("kill $(ps aux|grep java|grep ${PS_CFG_HOME?}/webserv/#{domain}/piaconfig|awk ' {print $2}')")
|
406
462
|
end
|
407
463
|
else
|
408
464
|
puts "Invalid type, see psa help"
|
@@ -410,32 +466,30 @@ def do_kill(type, domain)
|
|
410
466
|
end
|
411
467
|
|
412
468
|
def do_configure(type, domain)
|
413
|
-
if "#{PS_MULTI_HOME}" != "false"
|
414
|
-
ENV['PS_CFG_HOME'] = "#{PS_MULTI_HOME}/#{domain}"
|
415
|
-
end
|
416
|
-
|
417
469
|
case type
|
418
470
|
when "app"
|
419
471
|
do_cmd("#{PS_PSADMIN_PATH}/psadmin -c configure -d #{domain}")
|
420
472
|
when "prcs"
|
421
473
|
do_cmd("#{PS_PSADMIN_PATH}/psadmin -p configure -d #{domain}")
|
422
474
|
when "web"
|
423
|
-
|
475
|
+
do_webprof_reload("#{domain}")
|
424
476
|
else
|
425
477
|
puts "Invalid type, see psa help"
|
426
478
|
end
|
427
479
|
end
|
428
480
|
|
429
481
|
def do_purge(type, domain)
|
430
|
-
if "#{PS_MULTI_HOME}" != "false"
|
431
|
-
ENV['PS_CFG_HOME'] = "#{PS_MULTI_HOME}/#{domain}"
|
432
|
-
end
|
433
|
-
|
434
482
|
case type
|
435
483
|
when "app"
|
436
484
|
do_cmd("#{PS_PSADMIN_PATH}/psadmin -c purge -d #{domain}")
|
437
485
|
when "prcs"
|
438
|
-
|
486
|
+
case "#{OS_CONST}"
|
487
|
+
when "linux"
|
488
|
+
do_cmd("rm -rf ${PS_CFG_HOME?}/appserv/prcs/#{domain}/CACHE/*")
|
489
|
+
when "windows"
|
490
|
+
do_cmd("Remove-Item $(Get-ChildItem ${env:PS_CFG_HOME}/appserv/prcs/#{domain}/CACHE/* | ?{ $_.PSIsContainer}) -recurse -force -ErrorAction SilentlyContinue".gsub('/','\\'))
|
491
|
+
end
|
492
|
+
puts "prcs cache purged"
|
439
493
|
when "web"
|
440
494
|
case "#{OS_CONST}"
|
441
495
|
when "linux"
|
@@ -450,10 +504,6 @@ def do_purge(type, domain)
|
|
450
504
|
end
|
451
505
|
|
452
506
|
def do_flush(type, domain)
|
453
|
-
if "#{PS_MULTI_HOME}" != "false"
|
454
|
-
ENV['PS_CFG_HOME'] = "#{PS_MULTI_HOME}/#{domain}"
|
455
|
-
end
|
456
|
-
|
457
507
|
case type
|
458
508
|
when "app"
|
459
509
|
do_cmd("#{PS_PSADMIN_PATH}/psadmin -c cleanipc -d #{domain}")
|
@@ -485,37 +535,92 @@ def do_bounce(type, domain)
|
|
485
535
|
do_start(type, domain)
|
486
536
|
end
|
487
537
|
|
488
|
-
def
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
538
|
+
def do_hook(command, type, domain, script)
|
539
|
+
ENV['PSA_CMD'] = command
|
540
|
+
ENV['PSA_TYPE'] = type
|
541
|
+
ENV['PSA_DOMAIN'] = domain
|
542
|
+
out = `#{PS_HOOK_INTERP} #{script}`
|
543
|
+
puts out
|
544
|
+
end
|
545
|
+
|
546
|
+
def do_hookpre(command, type, domain)
|
547
|
+
if "#{PS_HOOK_PRE}" != "false"
|
548
|
+
"#{PS_PSA_DEBUG}" == "true" ? (puts "Executing domain pre command hook...\n\n") : nil
|
549
|
+
do_hook(command, type, domain, PS_HOOK_PRE)
|
550
|
+
"#{PS_PSA_DEBUG}" == "true" ? (puts "\n...hook done") : nil
|
551
|
+
end
|
552
|
+
end
|
553
|
+
|
554
|
+
def do_hookpost(command, type, domain)
|
555
|
+
if "#{PS_HOOK_POST}" != "false"
|
556
|
+
"#{PS_PSA_DEBUG}" == "true" ? (puts "Executing domain post command hook...\n\n") : nil
|
557
|
+
do_hook(command, type, domain, PS_HOOK_POST)
|
558
|
+
"#{PS_PSA_DEBUG}" == "true" ? (puts "\n...hook done") : nil
|
498
559
|
end
|
499
560
|
end
|
500
561
|
|
501
|
-
def
|
502
|
-
if
|
503
|
-
#
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
562
|
+
def do_hookstart(command, type, domain)
|
563
|
+
if "#{PS_HOOK_START}" != "false"
|
564
|
+
"#{PS_PSA_DEBUG}" == "true" ? (puts "Executing domain start hook...\n\n") : nil
|
565
|
+
do_hook(command, type, domain, PS_HOOK_START)
|
566
|
+
"#{PS_PSA_DEBUG}" == "true" ? (puts "\n...hook done") : nil
|
567
|
+
end
|
568
|
+
end
|
569
|
+
|
570
|
+
def do_hookstop(command, type, domain)
|
571
|
+
if "#{PS_HOOK_STOP}" != "false"
|
572
|
+
"#{PS_PSA_DEBUG}" == "true" ? (puts "Executing domain stop hook...\n\n") : nil
|
573
|
+
do_hook(command, type, domain, PS_HOOK_STOP)
|
574
|
+
"#{PS_PSA_DEBUG}" == "true" ? (puts "\n...hook done") : nil
|
575
|
+
end
|
576
|
+
end
|
577
|
+
|
578
|
+
def do_webprof_reload(domain)
|
579
|
+
puts "Reloading Web Profiles"
|
580
|
+
|
581
|
+
case "#{OS_CONST}"
|
582
|
+
when "linux"
|
583
|
+
"#{PS_PSA_DEBUG}" == "true" ? show_debug = true : show_debug = false
|
584
|
+
|
585
|
+
find_sites(domain).each do |s|
|
586
|
+
# set vars
|
587
|
+
url = "${ADMINSERVER_PROTOCOL?}://${ADMINSERVER_HOSTNAME?}:${ADMINSERVER_PORT?}/psp/#{s}/?cmd=login&"
|
588
|
+
src_env = ". ${PS_CFG_HOME?}/webserv/#{domain}/bin/setEnv.sh"
|
589
|
+
prop_file = "${PS_CFG_HOME?}/webserv/#{domain}/applications/peoplesoft/PORTAL.war/WEB-INF/psftdocs/#{s}/configuration.properties"
|
590
|
+
|
591
|
+
# set reload in config.props
|
592
|
+
do_cmd("sed -i 's/ReloadWebProfileWithoutRestart=.*/ReloadWebProfileWithoutRestart=1/g' #{prop_file}",show_debug)
|
593
|
+
|
594
|
+
# source setEnv and ping site
|
595
|
+
show_debug ? do_cmd("#{src_env} ; curl -s #{url}",show_debug) : do_cmd("#{src_env} ; curl -s -o /dev/null #{url}",show_debug)
|
596
|
+
|
597
|
+
# unset reload in config.props
|
598
|
+
do_cmd("sed -i 's/ReloadWebProfileWithoutRestart=.*/ReloadWebProfileWithoutRestart=0/g' #{prop_file}",show_debug)
|
599
|
+
|
600
|
+
# done
|
601
|
+
puts " - #{s}"
|
512
602
|
end
|
513
|
-
|
514
|
-
puts "
|
515
|
-
|
603
|
+
when "windows"
|
604
|
+
puts "Windows support coming soon."
|
605
|
+
#do_cmd(". #{env('PS_CFG_HOME')}/webserv/#{domain}/bin/setEnv.sh")
|
606
|
+
|
607
|
+
#find_sites.each do |s|
|
608
|
+
# # set vars
|
609
|
+
# prop_file = "#{env('PS_CFG_HOME')}/webserv/#{domain}/applications/peoplesoft/PORTAL.war/WEB-INF/psftdocs/#{s}}/configuration.properties"
|
610
|
+
# url = "http://#{PS_PIA_HOST}.#{PS_PIA_DOMAIN}:#{PS_PIA_PORT}/psp/#{s}/?cmd=login&"
|
611
|
+
# # set reload in config.props
|
612
|
+
# do_cmd("sed -i 's/ReloadWebProfileWithoutRestart=.*/ReloadWebProfileWithoutRestart=1/g' #{prop_file}")
|
613
|
+
# # ping site
|
614
|
+
# do_cmd("curl -s -o /dev/null '#{url}'")
|
615
|
+
# # unset reload in config.props
|
616
|
+
# do_cmd("sed -i 's/ReloadWebProfileWithoutRestart=.*/ReloadWebProfileWithoutRestart=0/g' #{prop_file}")
|
617
|
+
# # done
|
618
|
+
# puts " - #{s}"
|
619
|
+
#end
|
516
620
|
else
|
517
|
-
puts "
|
621
|
+
puts " badOS - #{OS_CONST}"
|
518
622
|
end
|
623
|
+
puts ""
|
519
624
|
end
|
520
625
|
|
521
626
|
def os
|
metadata
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: psadmin_plus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Benson
|
8
8
|
- Dan Iverson
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2023-04-27 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A psadmin helper tool
|
15
|
-
email:
|
15
|
+
email: info@psadmin.io
|
16
16
|
executables:
|
17
17
|
- psa
|
18
18
|
extensions: []
|
@@ -24,7 +24,7 @@ homepage: https://github.com/psadmin-io/psadmin-plus
|
|
24
24
|
licenses:
|
25
25
|
- MIT
|
26
26
|
metadata: {}
|
27
|
-
post_install_message:
|
27
|
+
post_install_message:
|
28
28
|
rdoc_options: []
|
29
29
|
require_paths:
|
30
30
|
- lib
|
@@ -39,8 +39,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
requirements: []
|
42
|
-
rubygems_version: 3.
|
43
|
-
signing_key:
|
42
|
+
rubygems_version: 3.2.15
|
43
|
+
signing_key:
|
44
44
|
specification_version: 4
|
45
45
|
summary: psadmin plus
|
46
46
|
test_files: []
|