psadmin_plus 0.0.5 → 0.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 +31 -4
- data/lib/psadmin_plus.rb +37 -14
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 08053857b9d46dfc80c308ea92265216f267c7da
|
4
|
+
data.tar.gz: 81df426b700e5bb882bf93f7fd7979fdaa22d03d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87bec5891e6a3bb8952ba9485a24c3ef8ccf05746117ab98b242dcd829a546d6e6bf448ca0f11b6e41d95fd37b7919a306e77e0bc029137ae45e45ab083f42ee
|
7
|
+
data.tar.gz: 9efbe7b0ccdb11fbca9fc24be60a6bc8d59fd0e1653c06b0f3395b654a039769ce24edf12bf8ad005a404e75e2229489de1aa0cc2f385dc9bcbfeb1a4e47f25b
|
data/bin/psa
CHANGED
@@ -35,13 +35,26 @@ PS_POOL_MGMT = ENV['PS_POOL_MGMT'] || "on"
|
|
35
35
|
PS_HEALTH_FILE = ENV['PS_HEALTH_FILE'] || "health.html"
|
36
36
|
PS_HEALTH_TIME = ENV['PS_HEALTH_TIME'] || "60"
|
37
37
|
PS_PSA_SUDO = ENV['PS_PSA_SUDO'] || "on"
|
38
|
-
PS_PSADMIN_PATH = "#{OS_CONST}" == "linux" ? "#{env('PS_HOME')}/bin" : "#{env('PS_HOME')}/appserv"
|
38
|
+
PS_PSADMIN_PATH = "#{OS_CONST}" == "linux" ? "#{env('PS_HOME')}/bin" : "cmd /c #{env('PS_HOME')}/appserv"
|
39
|
+
|
40
|
+
# validation
|
41
|
+
# check runtime user
|
42
|
+
if "#{OS_CONST}" == "linux" then
|
43
|
+
if !system("id #{PS_RUNTIME_USER} &> /dev/null") then
|
44
|
+
puts "#{PS_RUNTIME_USER} is not valid. Please correct PS_RUNTIME_USER, then try again."
|
45
|
+
exit
|
46
|
+
end
|
47
|
+
else
|
48
|
+
# windows - TODO
|
49
|
+
end
|
39
50
|
|
40
51
|
# process
|
41
52
|
commands.each do |c|
|
42
53
|
case "#{c}"
|
43
54
|
when "help"
|
44
55
|
do_help
|
56
|
+
when "admin"
|
57
|
+
do_admin
|
45
58
|
when "util"
|
46
59
|
do_util
|
47
60
|
when "list"
|
@@ -61,30 +74,44 @@ commands.each do |c|
|
|
61
74
|
end
|
62
75
|
end
|
63
76
|
domains.each do |d|
|
64
|
-
do_cmd_banner(c,t,d)
|
65
77
|
case "#{c}"
|
66
78
|
when "status"
|
79
|
+
do_cmd_banner(c,t,d)
|
67
80
|
do_status(t,d)
|
68
81
|
when "start"
|
82
|
+
do_cmd_banner(c,t,d)
|
69
83
|
do_start(t,d)
|
70
84
|
when "stop"
|
85
|
+
do_cmd_banner(c,t,d)
|
71
86
|
do_stop(t,d)
|
72
87
|
when "kill"
|
88
|
+
do_cmd_banner(c,t,d)
|
73
89
|
do_kill(t,d)
|
74
90
|
when "configure"
|
91
|
+
do_cmd_banner(c,t,d)
|
75
92
|
do_configure(t,d)
|
76
93
|
when "purge"
|
94
|
+
do_cmd_banner(c,t,d)
|
77
95
|
do_purge(t,d)
|
78
96
|
when "flush"
|
97
|
+
do_cmd_banner(c,t,d)
|
79
98
|
do_flush(t,d)
|
80
99
|
when "restart"
|
100
|
+
do_cmd_banner(c,t,d)
|
81
101
|
do_restart(t,d)
|
82
102
|
when "bounce"
|
103
|
+
do_cmd_banner(c,t,d)
|
83
104
|
do_bounce(t,d)
|
84
105
|
when "pooladd"
|
85
|
-
|
106
|
+
if t == "web"
|
107
|
+
do_cmd_banner(c,t,d)
|
108
|
+
do_pooladd(t,d)
|
109
|
+
end
|
86
110
|
when "poolrm"
|
87
|
-
|
111
|
+
if t == "web"
|
112
|
+
do_cmd_banner(c,t,d)
|
113
|
+
do_poolrm(t,d)
|
114
|
+
end
|
88
115
|
else
|
89
116
|
puts "Not a valid command. See psa help"
|
90
117
|
end
|
data/lib/psadmin_plus.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'rbconfig'
|
4
4
|
require 'etc'
|
5
|
+
require 'open3'
|
5
6
|
|
6
7
|
def do_help
|
7
8
|
puts "Usage: psa [command] <type> <domain>"
|
@@ -10,7 +11,7 @@ def do_help
|
|
10
11
|
puts " "
|
11
12
|
puts " help display this help message"
|
12
13
|
puts " list list domains"
|
13
|
-
puts " admin launch psadmin"
|
14
|
+
#puts " admin launch psadmin"
|
14
15
|
puts " summary PS_CFG_HOME summary, no type or domain needed"
|
15
16
|
puts " status status of the domain"
|
16
17
|
puts " start pooladd, if enabled, then start the domain"
|
@@ -66,7 +67,7 @@ def do_cmd(cmd, print = true)
|
|
66
67
|
end
|
67
68
|
end
|
68
69
|
when "windows"
|
69
|
-
out = `powershell -
|
70
|
+
out = `powershell -NoProfile -Command "#{cmd}"`
|
70
71
|
else
|
71
72
|
out = "Invalid OS"
|
72
73
|
end
|
@@ -74,8 +75,8 @@ def do_cmd(cmd, print = true)
|
|
74
75
|
end
|
75
76
|
|
76
77
|
def do_cmd_banner(c,t,d)
|
77
|
-
|
78
|
-
|
78
|
+
puts ""
|
79
|
+
puts "### #{c} - #{t} - #{d} ###"
|
79
80
|
end
|
80
81
|
|
81
82
|
def find_apps_nix
|
@@ -94,17 +95,17 @@ def find_webs_nix
|
|
94
95
|
end
|
95
96
|
|
96
97
|
def find_apps_win
|
97
|
-
apps = do_cmd("get-childitem #{env('PS_CFG_HOME')}/appserv/*/psappsrv.ubx |
|
98
|
+
apps = do_cmd("(get-childitem #{env('PS_CFG_HOME')}/appserv/*/psappsrv.ubx | Format-Table -property FullName -HideTableHeaders | Out-String).Trim()",false).split(/\n+/)
|
98
99
|
apps.map! {|app| app.split('\\')[-2]}
|
99
100
|
end
|
100
101
|
|
101
102
|
def find_prcss_win
|
102
|
-
prcss = do_cmd("get-childitem #{env('PS_CFG_HOME')}/appserv/prcs/*/psprcsrv.ubx |
|
103
|
+
prcss = do_cmd("(get-childitem #{env('PS_CFG_HOME')}/appserv/prcs/*/psprcsrv.ubx | Format-Table -property FullName -HideTableHeaders | Out-String).Trim()",false).split(/\n+/)
|
103
104
|
prcss.map! {|prcs| prcs.split("\\")[-2]}
|
104
105
|
end
|
105
106
|
|
106
107
|
def find_webs_win
|
107
|
-
webs = do_cmd("get-childitem #{env('PS_CFG_HOME')}/webserv/*/piaconfig |
|
108
|
+
webs = do_cmd("(get-childitem #{env('PS_CFG_HOME')}/webserv/*/piaconfig | Format-Table -property FullName -HideTableHeaders | Out-String).Trim()",false).split(/\n+/)
|
108
109
|
webs.map! {|web| web.split("\\")[-2]}
|
109
110
|
end
|
110
111
|
|
@@ -124,6 +125,10 @@ def do_util
|
|
124
125
|
puts "TODO: util"
|
125
126
|
end
|
126
127
|
|
128
|
+
def do_admin
|
129
|
+
do_cmd("#{PS_PSADMIN_PATH}/psadmin")
|
130
|
+
end
|
131
|
+
|
127
132
|
def do_list
|
128
133
|
puts "---"
|
129
134
|
print "hostname: " ; do_cmd('hostname')
|
@@ -134,7 +139,7 @@ def do_list
|
|
134
139
|
puts "PS_PSA_SUDO: #{PS_PSA_SUDO}"
|
135
140
|
puts "PS_POOL_MGMT: #{PS_POOL_MGMT}"
|
136
141
|
puts "PS_HEALTH_FILE: #{PS_HEALTH_FILE}"
|
137
|
-
puts "
|
142
|
+
puts "PS_HEALTH_TIME: #{PS_HEALTH_TIME}"
|
138
143
|
puts ""
|
139
144
|
puts "app:"
|
140
145
|
find_apps.each do |a|
|
@@ -154,7 +159,7 @@ def do_list
|
|
154
159
|
end
|
155
160
|
|
156
161
|
def do_summary
|
157
|
-
do_cmd("psadmin -envsummary")
|
162
|
+
do_cmd("#{PS_PSADMIN_PATH}/psadmin -envsummary")
|
158
163
|
#do_status("web","all")
|
159
164
|
end
|
160
165
|
|
@@ -194,7 +199,13 @@ def do_stop(type, domain)
|
|
194
199
|
when "prcs"
|
195
200
|
do_cmd("#{PS_PSADMIN_PATH}/psadmin -p stop -d #{domain}")
|
196
201
|
when "web"
|
197
|
-
|
202
|
+
case "#{OS_CONST}"
|
203
|
+
when "linux"
|
204
|
+
do_cmd("${PS_CFG_HOME?}/webserv/#{domain}/bin/stopPIA.sh")
|
205
|
+
when "windows"
|
206
|
+
# do_cmd("#{PS_PSADMIN_PATH}/psadmin -w shutdown! -d #{domain}".gsub('/','\\'))
|
207
|
+
do_cmd("cmd /c ${env:PS_CFG_HOME}/webserv/#{domain}/bin/stopPIA.cmd".gsub('/','\\'))
|
208
|
+
end
|
198
209
|
else
|
199
210
|
puts "Invalid type, see psa help"
|
200
211
|
end
|
@@ -233,8 +244,13 @@ def do_purge(type, domain)
|
|
233
244
|
when "prcs"
|
234
245
|
do_cmd("echo purge todo")
|
235
246
|
when "web"
|
236
|
-
|
237
|
-
|
247
|
+
case "#{OS_CONST}"
|
248
|
+
when "linux"
|
249
|
+
do_cmd("rm -rf ${PS_CFG_HOME?}/webserv/#{domain}/applications/peoplesoft/PORTAL*/*/cache*/")
|
250
|
+
puts "web cache purged"
|
251
|
+
when "windows"
|
252
|
+
do_cmd("Remove-Item $(Get-ChildItem ${env:PS_CFG_HOME}/webserv/#{domain}/applications/peoplesoft/PORTAL*/*/cache*/ | ?{ $_.PSIsContainer}) -recurse -force".gsub('/','\\'))
|
253
|
+
end
|
238
254
|
else
|
239
255
|
puts "Invalid type, see psa help"
|
240
256
|
end
|
@@ -270,7 +286,7 @@ def do_pooladd(type, domain)
|
|
270
286
|
if PS_POOL_MGMT == "on" then
|
271
287
|
# Change this function to match your pool member addtion process
|
272
288
|
puts "Adding web domain to load balanced pool..."
|
273
|
-
do_cmd("echo 'true' > #{env('PS_CFG_HOME')}/webserv/#{domain}/applications/peoplesoft/PORTAL.war/#{
|
289
|
+
do_cmd("echo 'true' > #{env('PS_CFG_HOME')}/webserv/#{domain}/applications/peoplesoft/PORTAL.war/#{PS_HEALTH_FILE}")
|
274
290
|
sleep(PS_HEALTH_TIME.to_i)
|
275
291
|
puts "...domain added to pool."
|
276
292
|
puts ""
|
@@ -283,7 +299,14 @@ def do_poolrm(type,domain)
|
|
283
299
|
if PS_POOL_MGMT == "on" then
|
284
300
|
# Change this function to match your pool member removal process
|
285
301
|
puts "Removing domain from load balanced pool..."
|
286
|
-
|
302
|
+
case "#{OS_CONST}"
|
303
|
+
when "linux"
|
304
|
+
do_cmd("rm -f #{env('PS_CFG_HOME')}/webserv/#{domain}/applications/peoplesoft/PORTAL.war/#{PS_HEALTH_FILE}")
|
305
|
+
when "windows"
|
306
|
+
do_cmd("remove-item -force #{env('PS_CFG_HOME')}/webserv/#{domain}/applications/peoplesoft/PORTAL.war/#{PS_HEALTH_FILE}")
|
307
|
+
else
|
308
|
+
puts " badOS - #{OS_CONST}"
|
309
|
+
end
|
287
310
|
sleep(PS_HEALTH_TIME.to_i)
|
288
311
|
puts "...domain removed from pool."
|
289
312
|
puts ""
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: psadmin_plus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Benson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A psadmin helper tool
|
14
14
|
email: kyle@psadmin.io
|
@@ -39,7 +39,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
39
39
|
version: '0'
|
40
40
|
requirements: []
|
41
41
|
rubyforge_project:
|
42
|
-
rubygems_version: 2.0.14
|
42
|
+
rubygems_version: 2.0.14
|
43
43
|
signing_key:
|
44
44
|
specification_version: 4
|
45
45
|
summary: psadmin plus
|