psadmin_plus 2.0.5 → 2.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/psa +156 -156
  3. data/lib/psadmin_plus.rb +642 -636
  4. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5811dc395997ea722f4b5c15f2d6552e9c0c351ade9c64346a9007ea3d600f6b
4
- data.tar.gz: 6785104563ac2b0cef79dce06bfc5980947c32bec12649bad37327b858fba4fa
3
+ metadata.gz: 0e0a6c139d1425345320bc485e585220c72dee5d2c17fa440a7de6c2eeb4f2cd
4
+ data.tar.gz: 3a595352998f4c045cab27803e1af1a4266c5823cc177a0f8360716003e859bf
5
5
  SHA512:
6
- metadata.gz: cb1dcae5cbbbd435802ddb7a546c892af6a68c6b172297ceec562db30762cc07079bbdb3833ad1c9eaa52f787fc853f79d1a9d4dc0dfdffb0c74267e2d02711b
7
- data.tar.gz: 01cef0fd3725cf5801df399f310bfc2e7eb9d7a940522a701978e71398a71e336e07f3976e20407413384205d340f83bc7691889476dae34131b469c32bfbcc5
6
+ metadata.gz: 28679fd69d09d403a61be342ac8eefb16e68e2fcaa2641869f7b180ca3bd98df1a82341e7c4b55994f93cbf96d6cf5d5f6fd532ea89e0c4d011b1d6c8ec45fc2
7
+ data.tar.gz: be5c3f5003bf45bf6566522041ff6996219b9aba7b8c0eea0977a1c1d50de1350e2a69009964cbf6c909cadf34dbd27a655395dc11f2e6d0620322606ee7362f
data/bin/psa CHANGED
@@ -1,156 +1,156 @@
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
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