psadmin_plus 0.0.6 → 0.0.7
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 +17 -10
 - data/lib/psadmin_plus.rb +165 -23
 - metadata +7 -6
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: c5bea0d7536994143d1b28eb77cfa1d4d2d245d1
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: d018bfdb4ac02509dc9cf391fe6857190bc91097
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: e17768a9ff8ac8352d33b522e691e19a2ad4d1e316156d2d2b2a88e3b47d18278df7233277f948dcf11a5029dcbcdd8cbc98fbedff3240d15fff304266719c21
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: a48e5720aa77cdf56adf97f7cc55b5cc03907c62d6c68058ea881f7c0ca1a1fb998ba2b335fbd94e90aa9175ff9965564222786c3f8cd8f5fbee6cf1b661ff02
         
     | 
    
        data/bin/psa
    CHANGED
    
    | 
         @@ -4,9 +4,10 @@ require 'psadmin_plus' 
     | 
|
| 
       4 
4 
     | 
    
         
             
            #require_relative '../lib/psadmin_plus.rb'
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            # options
         
     | 
| 
       7 
     | 
    
         
            -
            opts_c 
     | 
| 
       8 
     | 
    
         
            -
            opts_t 
     | 
| 
       9 
     | 
    
         
            -
            opts_d 
     | 
| 
      
 7 
     | 
    
         
            +
            opts_c   = ARGV.shift || "help"
         
     | 
| 
      
 8 
     | 
    
         
            +
            opts_t   = ARGV.shift || "all"
         
     | 
| 
      
 9 
     | 
    
         
            +
            opts_d   = ARGV.shift || "all"
         
     | 
| 
      
 10 
     | 
    
         
            +
            opt_cfg  = ARGV.shift
         
     | 
| 
       10 
11 
     | 
    
         | 
| 
       11 
12 
     | 
    
         
             
            commands = opts_c.split(',')
         
     | 
| 
       12 
13 
     | 
    
         
             
            types = opts_t.split(',')
         
     | 
| 
         @@ -15,6 +16,8 @@ domains = opts_d.split(',') 
     | 
|
| 
       15 
16 
     | 
    
         
             
            if types.include? "all" then types = ['app','prcs','web'] end
         
     | 
| 
       16 
17 
     | 
    
         
             
            if domains.include? "all" then all_domains = true end
         
     | 
| 
       17 
18 
     | 
    
         | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
       18 
21 
     | 
    
         
             
            # setup environment
         
     | 
| 
       19 
22 
     | 
    
         
             
            PS_PSA_CONF = ENV['PS_PSA_CONF'] || "#{ENV['HOME']}/.psa.conf"
         
     | 
| 
       20 
23 
     | 
    
         
             
            if File.exists?(PS_PSA_CONF) then
         
     | 
| 
         @@ -29,13 +32,17 @@ if File.exists?(PS_PSA_CONF) then 
     | 
|
| 
       29 
32 
     | 
    
         
             
            end
         
     | 
| 
       30 
33 
     | 
    
         | 
| 
       31 
34 
     | 
    
         
             
            # constants
         
     | 
| 
       32 
     | 
    
         
            -
            OS_CONST 
     | 
| 
       33 
     | 
    
         
            -
            PS_RUNTIME_USER 
     | 
| 
       34 
     | 
    
         
            -
            PS_POOL_MGMT 
     | 
| 
       35 
     | 
    
         
            -
            PS_HEALTH_FILE 
     | 
| 
       36 
     | 
    
         
            -
            PS_HEALTH_TIME 
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
      
 35 
     | 
    
         
            +
            OS_CONST            = os
         
     | 
| 
      
 36 
     | 
    
         
            +
            PS_RUNTIME_USER     = ENV['PS_RUNTIME_USER'] || "psadm2"
         
     | 
| 
      
 37 
     | 
    
         
            +
            PS_POOL_MGMT        = ENV['PS_POOL_MGMT'] || "on"
         
     | 
| 
      
 38 
     | 
    
         
            +
            PS_HEALTH_FILE      = ENV['PS_HEALTH_FILE'] || "health.html"
         
     | 
| 
      
 39 
     | 
    
         
            +
            PS_HEALTH_TIME      = ENV['PS_HEALTH_TIME'] || "60"
         
     | 
| 
      
 40 
     | 
    
         
            +
            PS_HEALTH_TEXT      = ENV['PS_HEALTH_TEXT'] || "true"
         
     | 
| 
      
 41 
     | 
    
         
            +
            PS_PSA_SUDO         = ENV['PS_PSA_SUDO'] || "on"
         
     | 
| 
      
 42 
     | 
    
         
            +
            PS_PSADMIN_PATH     = "#{OS_CONST}" == "linux" ? "#{env('PS_HOME')}/bin" : "cmd /c #{env('PS_HOME')}/appserv"
         
     | 
| 
      
 43 
     | 
    
         
            +
            PS_WIN_SERVICES     = ENV['PS_WIN_SERVICES'] || "false"
         
     | 
| 
      
 44 
     | 
    
         
            +
            PS_MULTI_HOME       = ENV['PS_MULTI_HOME'] || "false"
         
     | 
| 
      
 45 
     | 
    
         
            +
            PS_PSA_DEBUG        = ENV['PS_PSA_DEBUG']  || "false"
         
     | 
| 
       39 
46 
     | 
    
         | 
| 
       40 
47 
     | 
    
         
             
            # validation
         
     | 
| 
       41 
48 
     | 
    
         
             
            # check runtime user
         
     | 
    
        data/lib/psadmin_plus.rb
    CHANGED
    
    | 
         @@ -50,24 +50,49 @@ def do_is_runtime_user_win 
     | 
|
| 
       50 
50 
     | 
    
         
             
            end
         
     | 
| 
       51 
51 
     | 
    
         | 
| 
       52 
52 
     | 
    
         
             
            def env(var)
         
     | 
| 
       53 
     | 
    
         
            -
               result = "#{OS_CONST}" == "linux" ? "${#{var}}" : " 
     | 
| 
      
 53 
     | 
    
         
            +
               result = "#{OS_CONST}" == "linux" ? "${#{var}}" : "%#{var}%"
         
     | 
| 
       54 
54 
     | 
    
         
             
            end
         
     | 
| 
       55 
55 
     | 
    
         | 
| 
       56 
     | 
    
         
            -
            def do_cmd(cmd, print = true)
         
     | 
| 
      
 56 
     | 
    
         
            +
            def do_cmd(cmd, print = true, powershell = true)
         
     | 
| 
       57 
57 
     | 
    
         
             
                case "#{OS_CONST}"
         
     | 
| 
       58 
58 
     | 
    
         
             
                when "linux"
         
     | 
| 
       59 
59 
     | 
    
         
             
                    if do_is_runtime_user_nix
         
     | 
| 
      
 60 
     | 
    
         
            +
                        case "#{PS_PSA_DEBUG}"
         
     | 
| 
      
 61 
     | 
    
         
            +
                        when true
         
     | 
| 
      
 62 
     | 
    
         
            +
                            p "Command: #{cmd}"
         
     | 
| 
      
 63 
     | 
    
         
            +
                        end
         
     | 
| 
       60 
64 
     | 
    
         
             
                        out = `#{cmd}`
         
     | 
| 
       61 
65 
     | 
    
         
             
                    else
         
     | 
| 
       62 
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
         
     | 
| 
       63 
71 
     | 
    
         
             
                            out = `sudo su - #{PS_RUNTIME_USER} -c '#{cmd}'`
         
     | 
| 
       64 
72 
     | 
    
         
             
                        else
         
     | 
| 
       65 
73 
     | 
    
         
             
                            print "#{PS_RUNTIME_USER} "
         
     | 
| 
      
 74 
     | 
    
         
            +
                            case "#{PS_PSA_DEBUG}"
         
     | 
| 
      
 75 
     | 
    
         
            +
                            when true
         
     | 
| 
      
 76 
     | 
    
         
            +
                                p "Command: su - #{PS_RUNTIME_USER} -c '#{cmd}'"
         
     | 
| 
      
 77 
     | 
    
         
            +
                            end
         
     | 
| 
       66 
78 
     | 
    
         
             
                            out = `su - #{PS_RUNTIME_USER} -c '#{cmd}'`
         
     | 
| 
       67 
79 
     | 
    
         
             
                        end
         
     | 
| 
       68 
80 
     | 
    
         
             
                    end
         
     | 
| 
       69 
81 
     | 
    
         
             
                when "windows"
         
     | 
| 
       70 
     | 
    
         
            -
                     
     | 
| 
      
 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
         
     | 
| 
       71 
96 
     | 
    
         
             
                else
         
     | 
| 
       72 
97 
     | 
    
         
             
                    out = "Invalid OS"
         
     | 
| 
       73 
98 
     | 
    
         
             
                end
         
     | 
| 
         @@ -80,32 +105,62 @@ def do_cmd_banner(c,t,d) 
     | 
|
| 
       80 
105 
     | 
    
         
             
            end
         
     | 
| 
       81 
106 
     | 
    
         | 
| 
       82 
107 
     | 
    
         
             
            def find_apps_nix
         
     | 
| 
       83 
     | 
    
         
            -
                 
     | 
| 
      
 108 
     | 
    
         
            +
                case "#{PS_MULTI_HOME}"
         
     | 
| 
      
 109 
     | 
    
         
            +
                when "false"
         
     | 
| 
      
 110 
     | 
    
         
            +
                    apps = do_cmd("find #{env('PS_CFG_HOME')}/appserv/*/psappsrv.ubx",false).split(/\n+/)
         
     | 
| 
      
 111 
     | 
    
         
            +
                else
         
     | 
| 
      
 112 
     | 
    
         
            +
                    apps = do_cmd("find #{PS_MULTI_HOME}/*/appserv/*/psappsrv.ubx",false).split(/\n+/)
         
     | 
| 
      
 113 
     | 
    
         
            +
                end
         
     | 
| 
       84 
114 
     | 
    
         
             
                apps.map! {|app| app.split("/")[-2]}
         
     | 
| 
       85 
115 
     | 
    
         
             
            end
         
     | 
| 
       86 
116 
     | 
    
         | 
| 
       87 
117 
     | 
    
         
             
            def find_prcss_nix
         
     | 
| 
       88 
     | 
    
         
            -
                 
     | 
| 
      
 118 
     | 
    
         
            +
                case "#{PS_MULTI_HOME}"
         
     | 
| 
      
 119 
     | 
    
         
            +
                when "false"
         
     | 
| 
      
 120 
     | 
    
         
            +
                    prcss = do_cmd("find #{env('PS_CFG_HOME')}/appserv/prcs/*/psprcsrv.ubx",false).split(/\n+/)
         
     | 
| 
      
 121 
     | 
    
         
            +
                else 
         
     | 
| 
      
 122 
     | 
    
         
            +
                    prcss = do_cmd("find #{PS_MULTI_HOME}/*/appserv/prcs/*/psprcsrv.ubx",false).split(/\n+/)
         
     | 
| 
      
 123 
     | 
    
         
            +
                end
         
     | 
| 
       89 
124 
     | 
    
         
             
                prcss.map! {|prcs| prcs.split("/")[-2]}
         
     | 
| 
       90 
125 
     | 
    
         
             
            end
         
     | 
| 
       91 
126 
     | 
    
         | 
| 
       92 
127 
     | 
    
         
             
            def find_webs_nix
         
     | 
| 
       93 
     | 
    
         
            -
                 
     | 
| 
      
 128 
     | 
    
         
            +
                case "#{PS_MULTI_HOME}"
         
     | 
| 
      
 129 
     | 
    
         
            +
                when "false"
         
     | 
| 
      
 130 
     | 
    
         
            +
                    webs = do_cmd("find #{env('PS_CFG_HOME')}/webserv/*/piaconfig -maxdepth 0",false).split(/\n+/)
         
     | 
| 
      
 131 
     | 
    
         
            +
                else
         
     | 
| 
      
 132 
     | 
    
         
            +
                    webs = do_cmd("find #{PS_MULTI_HOME}/*/webserv/*/piaconfig -maxdepth 0",false).split(/\n+/)
         
     | 
| 
      
 133 
     | 
    
         
            +
                end
         
     | 
| 
       94 
134 
     | 
    
         
             
                webs.map! {|web| web.split("/")[-2]}
         
     | 
| 
       95 
135 
     | 
    
         
             
            end
         
     | 
| 
       96 
136 
     | 
    
         | 
| 
       97 
137 
     | 
    
         
             
            def find_apps_win
         
     | 
| 
       98 
     | 
    
         
            -
                 
     | 
| 
      
 138 
     | 
    
         
            +
                case "#{PS_MULTI_HOME}"
         
     | 
| 
      
 139 
     | 
    
         
            +
                when "false"
         
     | 
| 
      
 140 
     | 
    
         
            +
                    apps = do_cmd("(get-childitem #{env('PS_CFG_HOME')}/appserv/*/psappsrv.ubx | Format-Table -property FullName -HideTableHeaders | Out-String).Trim()",false).split(/\n+/)
         
     | 
| 
      
 141 
     | 
    
         
            +
                else
         
     | 
| 
      
 142 
     | 
    
         
            +
                    apps = do_cmd("(get-childitem #{PS_MULTI_HOME}/*/appserv/*/psappsrv.ubx | Format-Table -property FullName -HideTableHeaders | Out-String).Trim()",false).split(/\n+/)
         
     | 
| 
      
 143 
     | 
    
         
            +
                end
         
     | 
| 
       99 
144 
     | 
    
         
             
                apps.map! {|app| app.split('\\')[-2]}
         
     | 
| 
       100 
145 
     | 
    
         
             
            end
         
     | 
| 
       101 
146 
     | 
    
         | 
| 
       102 
147 
     | 
    
         
             
            def find_prcss_win
         
     | 
| 
       103 
     | 
    
         
            -
                 
     | 
| 
      
 148 
     | 
    
         
            +
                case "#{PS_MULTI_HOME}"
         
     | 
| 
      
 149 
     | 
    
         
            +
                when "false"
         
     | 
| 
      
 150 
     | 
    
         
            +
                    prcss = do_cmd("(get-childitem #{env('PS_CFG_HOME')}/appserv/prcs/*/psprcsrv.ubx | Format-Table -property FullName -HideTableHeaders | Out-String).Trim()",false).split(/\n+/)
         
     | 
| 
      
 151 
     | 
    
         
            +
                else
         
     | 
| 
      
 152 
     | 
    
         
            +
                    prcss = do_cmd("(get-childitem #{PS_MULTI_HOME}/*/appserv/prcs/*/psprcsrv.ubx | Format-Table -property FullName -HideTableHeaders | Out-String).Trim()",false).split(/\n+/)
         
     | 
| 
      
 153 
     | 
    
         
            +
                end
         
     | 
| 
       104 
154 
     | 
    
         
             
                prcss.map! {|prcs| prcs.split("\\")[-2]}
         
     | 
| 
       105 
155 
     | 
    
         
             
            end
         
     | 
| 
       106 
156 
     | 
    
         | 
| 
       107 
157 
     | 
    
         
             
            def find_webs_win
         
     | 
| 
       108 
     | 
    
         
            -
                 
     | 
| 
      
 158 
     | 
    
         
            +
                case "#{PS_MULTI_HOME}"
         
     | 
| 
      
 159 
     | 
    
         
            +
                when "false"
         
     | 
| 
      
 160 
     | 
    
         
            +
                    webs = do_cmd("(get-childitem #{env('PS_CFG_HOME')}/webserv/*/piaconfig | Format-Table -property FullName -HideTableHeaders | Out-String).Trim()",false).split(/\n+/)
         
     | 
| 
      
 161 
     | 
    
         
            +
                else
         
     | 
| 
      
 162 
     | 
    
         
            +
                    webs = do_cmd("(get-childitem #{PS_MULTI_HOME}/*/webserv/*/piaconfig | Format-Table -property FullName -HideTableHeaders | Out-String).Trim()",false).split(/\n+/)
         
     | 
| 
      
 163 
     | 
    
         
            +
                end
         
     | 
| 
       109 
164 
     | 
    
         
             
                webs.map! {|web| web.split("\\")[-2]}
         
     | 
| 
       110 
165 
     | 
    
         
             
            end
         
     | 
| 
       111 
166 
     | 
    
         | 
| 
         @@ -133,13 +188,19 @@ def do_list 
     | 
|
| 
       133 
188 
     | 
    
         
             
                puts "---"
         
     | 
| 
       134 
189 
     | 
    
         
             
                print "hostname:        " ; do_cmd('hostname')
         
     | 
| 
       135 
190 
     | 
    
         
             
                print "ps-home:         " ; do_cmd('echo ' + env('PS_HOME'))
         
     | 
| 
       136 
     | 
    
         
            -
                 
     | 
| 
      
 191 
     | 
    
         
            +
                if PS_MULTI_HOME == "false" 
         
     | 
| 
      
 192 
     | 
    
         
            +
                    print "ps-cfg-home:     " ; do_cmd('echo ' + env('PS_CFG_HOME'))
         
     | 
| 
      
 193 
     | 
    
         
            +
                end
         
     | 
| 
       137 
194 
     | 
    
         
             
                puts ""
         
     | 
| 
       138 
195 
     | 
    
         
             
                puts "PS_RUNTIME_USER: #{PS_RUNTIME_USER}"
         
     | 
| 
       139 
196 
     | 
    
         
             
                puts "PS_PSA_SUDO:     #{PS_PSA_SUDO}"
         
     | 
| 
       140 
197 
     | 
    
         
             
                puts "PS_POOL_MGMT:    #{PS_POOL_MGMT}"
         
     | 
| 
       141 
198 
     | 
    
         
             
                puts "PS_HEALTH_FILE:  #{PS_HEALTH_FILE}"
         
     | 
| 
       142 
199 
     | 
    
         
             
                puts "PS_HEALTH_TIME:  #{PS_HEALTH_TIME}"
         
     | 
| 
      
 200 
     | 
    
         
            +
                puts "PS_HEALTH_TEXT:  #{PS_HEALTH_TEXT}"
         
     | 
| 
      
 201 
     | 
    
         
            +
                puts "PS_WIN_SERVICES: #{PS_WIN_SERVICES}"
         
     | 
| 
      
 202 
     | 
    
         
            +
                puts "PS_MULT_HOME:    #{PS_MULTI_HOME}"
         
     | 
| 
      
 203 
     | 
    
         
            +
                puts "PS_PSA_DEBUG:    #{PS_PSA_DEBUG}"
         
     | 
| 
       143 
204 
     | 
    
         
             
                puts "" 
         
     | 
| 
       144 
205 
     | 
    
         
             
                puts "app:"
         
     | 
| 
       145 
206 
     | 
    
         
             
                find_apps.each do |a|
         
     | 
| 
         @@ -159,11 +220,19 @@ def do_list 
     | 
|
| 
       159 
220 
     | 
    
         
             
            end
         
     | 
| 
       160 
221 
     | 
    
         | 
| 
       161 
222 
     | 
    
         
             
            def do_summary
         
     | 
| 
      
 223 
     | 
    
         
            +
                if "#{PS_MULTI_HOME}" != "false"
         
     | 
| 
      
 224 
     | 
    
         
            +
                    ENV['PS_CFG_HOME'] = "#{PS_MULTI_HOME}/#{domain}"
         
     | 
| 
      
 225 
     | 
    
         
            +
                end
         
     | 
| 
      
 226 
     | 
    
         
            +
             
     | 
| 
       162 
227 
     | 
    
         
             
                do_cmd("#{PS_PSADMIN_PATH}/psadmin -envsummary")
         
     | 
| 
       163 
228 
     | 
    
         
             
                #do_status("web","all")
         
     | 
| 
       164 
229 
     | 
    
         
             
            end
         
     | 
| 
       165 
230 
     | 
    
         | 
| 
       166 
231 
     | 
    
         
             
            def do_status(type, domain)
         
     | 
| 
      
 232 
     | 
    
         
            +
                if "#{PS_MULTI_HOME}" != "false"
         
     | 
| 
      
 233 
     | 
    
         
            +
                    ENV['PS_CFG_HOME'] = "#{PS_MULTI_HOME}/#{domain}"
         
     | 
| 
      
 234 
     | 
    
         
            +
                end
         
     | 
| 
      
 235 
     | 
    
         
            +
             
     | 
| 
       167 
236 
     | 
    
         
             
                case type
         
     | 
| 
       168 
237 
     | 
    
         
             
                when "app"
         
     | 
| 
       169 
238 
     | 
    
         
             
                    do_cmd("#{PS_PSADMIN_PATH}/psadmin -c sstatus -d #{domain}")
         
     | 
| 
         @@ -180,31 +249,83 @@ def do_status(type, domain) 
     | 
|
| 
       180 
249 
     | 
    
         
             
            end
         
     | 
| 
       181 
250 
     | 
    
         | 
| 
       182 
251 
     | 
    
         
             
            def do_start(type, domain)
         
     | 
| 
      
 252 
     | 
    
         
            +
                if "#{PS_MULTI_HOME}" != "false"
         
     | 
| 
      
 253 
     | 
    
         
            +
                    ENV['PS_CFG_HOME'] = "#{PS_MULTI_HOME}/#{domain}"
         
     | 
| 
      
 254 
     | 
    
         
            +
                end
         
     | 
| 
      
 255 
     | 
    
         
            +
             
     | 
| 
      
 256 
     | 
    
         
            +
                web_service_name    = ENV['WEB_SERVICE_NAME'] || "Psft*Pia*#{domain}*"
         
     | 
| 
      
 257 
     | 
    
         
            +
                app_service_name    = ENV['APP_SERVICE_NAME'] || "Psft*App*#{domain}*"
         
     | 
| 
      
 258 
     | 
    
         
            +
                prcs_service_name   = ENV['PRCS_SERVICE_NAME'] || "Psft*Prcs*#{domain}*"
         
     | 
| 
      
 259 
     | 
    
         
            +
             
     | 
| 
       183 
260 
     | 
    
         
             
                case type
         
     | 
| 
       184 
261 
     | 
    
         
             
                when "app"
         
     | 
| 
       185 
     | 
    
         
            -
                     
     | 
| 
      
 262 
     | 
    
         
            +
                    case "#{PS_WIN_SERVICES}"
         
     | 
| 
      
 263 
     | 
    
         
            +
                    when "true"
         
     | 
| 
      
 264 
     | 
    
         
            +
                        do_cmd("start-service #{app_service_name}")
         
     | 
| 
      
 265 
     | 
    
         
            +
                    else
         
     | 
| 
      
 266 
     | 
    
         
            +
                        do_cmd("#{PS_PSADMIN_PATH}/psadmin -c boot -d #{domain}")
         
     | 
| 
      
 267 
     | 
    
         
            +
                    end
         
     | 
| 
       186 
268 
     | 
    
         
             
                when "prcs"
         
     | 
| 
       187 
     | 
    
         
            -
                     
     | 
| 
      
 269 
     | 
    
         
            +
                    case "#{PS_WIN_SERVICES}"
         
     | 
| 
      
 270 
     | 
    
         
            +
                    when "true"
         
     | 
| 
      
 271 
     | 
    
         
            +
                        do_cmd("start-service #{prcs_service_name}")
         
     | 
| 
      
 272 
     | 
    
         
            +
                    else
         
     | 
| 
      
 273 
     | 
    
         
            +
                        do_cmd("#{PS_PSADMIN_PATH}/psadmin -p start -d #{domain}")
         
     | 
| 
      
 274 
     | 
    
         
            +
                    end
         
     | 
| 
       188 
275 
     | 
    
         
             
                when "web"
         
     | 
| 
       189 
     | 
    
         
            -
                     
     | 
| 
      
 276 
     | 
    
         
            +
                    case "#{OS_CONST}"
         
     | 
| 
      
 277 
     | 
    
         
            +
                    when "linux"
         
     | 
| 
      
 278 
     | 
    
         
            +
                        do_cmd("#{PS_PSADMIN_PATH}/psadmin -w start -d #{domain}")
         
     | 
| 
      
 279 
     | 
    
         
            +
                    when "windows"
         
     | 
| 
      
 280 
     | 
    
         
            +
                        case "#{PS_WIN_SERVICES}"
         
     | 
| 
      
 281 
     | 
    
         
            +
                        when "true"
         
     | 
| 
      
 282 
     | 
    
         
            +
                            do_cmd("start-service #{web_service_name}")
         
     | 
| 
      
 283 
     | 
    
         
            +
                        else
         
     | 
| 
      
 284 
     | 
    
         
            +
                            do_cmd("#{PS_PSADMIN_PATH}/psadmin -w start -d #{domain}", true, false)
         
     | 
| 
      
 285 
     | 
    
         
            +
                        end
         
     | 
| 
      
 286 
     | 
    
         
            +
                    end
         
     | 
| 
      
 287 
     | 
    
         
            +
                    do_pooladd(type,domain)
         
     | 
| 
       190 
288 
     | 
    
         
             
                else
         
     | 
| 
       191 
289 
     | 
    
         
             
                    puts "Invalid type, see psa help"
         
     | 
| 
       192 
290 
     | 
    
         
             
                end
         
     | 
| 
       193 
291 
     | 
    
         
             
            end
         
     | 
| 
       194 
292 
     | 
    
         | 
| 
       195 
293 
     | 
    
         
             
            def do_stop(type, domain)
         
     | 
| 
      
 294 
     | 
    
         
            +
                if "#{PS_MULTI_HOME}" != "false"
         
     | 
| 
      
 295 
     | 
    
         
            +
                    ENV['PS_CFG_HOME'] = "#{PS_MULTI_HOME}/#{domain}"
         
     | 
| 
      
 296 
     | 
    
         
            +
                end
         
     | 
| 
      
 297 
     | 
    
         
            +
                
         
     | 
| 
      
 298 
     | 
    
         
            +
                web_service_name    = ENV['WEB_SERVICE_NAME'] || "Psft*Pia*#{domain}*"
         
     | 
| 
      
 299 
     | 
    
         
            +
                app_service_name    = ENV['APP_SERVICE_NAME'] || "Psft*App*#{domain}*"
         
     | 
| 
      
 300 
     | 
    
         
            +
                prcs_service_name   = ENV['PRCS_SERVICE_NAME'] || "Psft*Prcs*#{domain}*"
         
     | 
| 
      
 301 
     | 
    
         
            +
             
     | 
| 
       196 
302 
     | 
    
         
             
                case type
         
     | 
| 
       197 
303 
     | 
    
         
             
                when "app"
         
     | 
| 
       198 
     | 
    
         
            -
                     
     | 
| 
      
 304 
     | 
    
         
            +
                    case "#{PS_WIN_SERVICES}"
         
     | 
| 
      
 305 
     | 
    
         
            +
                    when "true"
         
     | 
| 
      
 306 
     | 
    
         
            +
                        do_cmd("stop-service #{app_service_name}")
         
     | 
| 
      
 307 
     | 
    
         
            +
                    else
         
     | 
| 
      
 308 
     | 
    
         
            +
                        do_cmd("#{PS_PSADMIN_PATH}/psadmin -c shutdown -d #{domain}")
         
     | 
| 
      
 309 
     | 
    
         
            +
                    end
         
     | 
| 
       199 
310 
     | 
    
         
             
                when "prcs"
         
     | 
| 
       200 
     | 
    
         
            -
                     
     | 
| 
      
 311 
     | 
    
         
            +
                    case "#{PS_WIN_SERVICES}"
         
     | 
| 
      
 312 
     | 
    
         
            +
                    when "true"
         
     | 
| 
      
 313 
     | 
    
         
            +
                        do_cmd("stop-service #{prcs_service_name}")
         
     | 
| 
      
 314 
     | 
    
         
            +
                    else
         
     | 
| 
      
 315 
     | 
    
         
            +
                        do_cmd("#{PS_PSADMIN_PATH}/psadmin -p stop -d #{domain}")
         
     | 
| 
      
 316 
     | 
    
         
            +
                    end
         
     | 
| 
       201 
317 
     | 
    
         
             
                when "web"
         
     | 
| 
      
 318 
     | 
    
         
            +
                    do_poolrm(type,domain)
         
     | 
| 
       202 
319 
     | 
    
         
             
                    case "#{OS_CONST}"
         
     | 
| 
       203 
320 
     | 
    
         
             
                    when "linux"
         
     | 
| 
       204 
321 
     | 
    
         
             
                        do_cmd("${PS_CFG_HOME?}/webserv/#{domain}/bin/stopPIA.sh")
         
     | 
| 
       205 
322 
     | 
    
         
             
                    when "windows"
         
     | 
| 
       206 
     | 
    
         
            -
                         
     | 
| 
       207 
     | 
    
         
            -
                         
     | 
| 
      
 323 
     | 
    
         
            +
                        case "#{PS_WIN_SERVICES}"
         
     | 
| 
      
 324 
     | 
    
         
            +
                        when "true"
         
     | 
| 
      
 325 
     | 
    
         
            +
                            do_cmd("stop-service #{web_service_name}")
         
     | 
| 
      
 326 
     | 
    
         
            +
                        else
         
     | 
| 
      
 327 
     | 
    
         
            +
                            do_cmd("#{PS_PSADMIN_PATH}/psadmin -w shutdown -d #{domain}", true, false)
         
     | 
| 
      
 328 
     | 
    
         
            +
                        end
         
     | 
| 
       208 
329 
     | 
    
         
             
                    end
         
     | 
| 
       209 
330 
     | 
    
         
             
                else
         
     | 
| 
       210 
331 
     | 
    
         
             
                    puts "Invalid type, see psa help"
         
     | 
| 
         @@ -212,19 +333,32 @@ def do_stop(type, domain) 
     | 
|
| 
       212 
333 
     | 
    
         
             
            end
         
     | 
| 
       213 
334 
     | 
    
         | 
| 
       214 
335 
     | 
    
         
             
            def do_kill(type, domain)
         
     | 
| 
      
 336 
     | 
    
         
            +
                if "#{PS_MULTI_HOME}" != "false"
         
     | 
| 
      
 337 
     | 
    
         
            +
                    ENV['PS_CFG_HOME'] = "#{PS_MULTI_HOME}/#{domain}"
         
     | 
| 
      
 338 
     | 
    
         
            +
                end
         
     | 
| 
      
 339 
     | 
    
         
            +
             
     | 
| 
       215 
340 
     | 
    
         
             
                case type
         
     | 
| 
       216 
341 
     | 
    
         
             
                when "app"
         
     | 
| 
       217 
342 
     | 
    
         
             
                    do_cmd("#{PS_PSADMIN_PATH}/psadmin -c shutdown! -d #{domain}")
         
     | 
| 
       218 
343 
     | 
    
         
             
                when "prcs"
         
     | 
| 
       219 
344 
     | 
    
         
             
                    do_cmd("#{PS_PSADMIN_PATH}/psadmin -p kill -d #{domain}")
         
     | 
| 
       220 
345 
     | 
    
         
             
                when "web"
         
     | 
| 
       221 
     | 
    
         
            -
                     
     | 
| 
      
 346 
     | 
    
         
            +
                    case "#{OS_CONST}"
         
     | 
| 
      
 347 
     | 
    
         
            +
                    when "windows"
         
     | 
| 
      
 348 
     | 
    
         
            +
                        do_cmd("(gwmi win32_process | where {$_.Name -eq 'Java.exe'} | where {$_.CommandLine -match '#{domain}'}).ProcessId  -ErrorAction SilentlyContinue | % { stop-process $_ -force } -ErrorAction SilentlyContinue")
         
     | 
| 
      
 349 
     | 
    
         
            +
                    when "linux"
         
     | 
| 
      
 350 
     | 
    
         
            +
                        return #kill n/a
         
     | 
| 
      
 351 
     | 
    
         
            +
                    end
         
     | 
| 
       222 
352 
     | 
    
         
             
                else
         
     | 
| 
       223 
353 
     | 
    
         
             
                    puts "Invalid type, see psa help"
         
     | 
| 
       224 
354 
     | 
    
         
             
                end
         
     | 
| 
       225 
355 
     | 
    
         
             
            end
         
     | 
| 
       226 
356 
     | 
    
         | 
| 
       227 
357 
     | 
    
         
             
            def do_configure(type, domain)
         
     | 
| 
      
 358 
     | 
    
         
            +
                if "#{PS_MULTI_HOME}" != "false"
         
     | 
| 
      
 359 
     | 
    
         
            +
                    ENV['PS_CFG_HOME'] = "#{PS_MULTI_HOME}/#{domain}"
         
     | 
| 
      
 360 
     | 
    
         
            +
                end
         
     | 
| 
      
 361 
     | 
    
         
            +
             
     | 
| 
       228 
362 
     | 
    
         
             
                case type
         
     | 
| 
       229 
363 
     | 
    
         
             
                when "app"
         
     | 
| 
       230 
364 
     | 
    
         
             
                    do_cmd("#{PS_PSADMIN_PATH}/psadmin -c configure -d #{domain}")
         
     | 
| 
         @@ -238,6 +372,10 @@ def do_configure(type, domain) 
     | 
|
| 
       238 
372 
     | 
    
         
             
            end
         
     | 
| 
       239 
373 
     | 
    
         | 
| 
       240 
374 
     | 
    
         
             
            def do_purge(type, domain)
         
     | 
| 
      
 375 
     | 
    
         
            +
                if "#{PS_MULTI_HOME}" != "false"
         
     | 
| 
      
 376 
     | 
    
         
            +
                    ENV['PS_CFG_HOME'] = "#{PS_MULTI_HOME}/#{domain}"
         
     | 
| 
      
 377 
     | 
    
         
            +
                end
         
     | 
| 
      
 378 
     | 
    
         
            +
             
     | 
| 
       241 
379 
     | 
    
         
             
                case type
         
     | 
| 
       242 
380 
     | 
    
         
             
                when "app"
         
     | 
| 
       243 
381 
     | 
    
         
             
                    do_cmd("#{PS_PSADMIN_PATH}/psadmin -c purge -d #{domain}")
         
     | 
| 
         @@ -249,7 +387,7 @@ def do_purge(type, domain) 
     | 
|
| 
       249 
387 
     | 
    
         
             
                        do_cmd("rm -rf ${PS_CFG_HOME?}/webserv/#{domain}/applications/peoplesoft/PORTAL*/*/cache*/")
         
     | 
| 
       250 
388 
     | 
    
         
             
                        puts "web cache purged"
         
     | 
| 
       251 
389 
     | 
    
         
             
                    when "windows"
         
     | 
| 
       252 
     | 
    
         
            -
                        do_cmd("Remove-Item $(Get-ChildItem ${env:PS_CFG_HOME}/webserv/#{domain}/applications/peoplesoft/PORTAL*/*/cache*/ | ?{ $_.PSIsContainer}) -recurse -force".gsub('/','\\'))
         
     | 
| 
      
 390 
     | 
    
         
            +
                        do_cmd("Remove-Item $(Get-ChildItem ${env:PS_CFG_HOME}/webserv/#{domain}/applications/peoplesoft/PORTAL*/*/cache*/ | ?{ $_.PSIsContainer}) -recurse -force -ErrorAction SilentlyContinue".gsub('/','\\'))
         
     | 
| 
       253 
391 
     | 
    
         
             
                    end
         
     | 
| 
       254 
392 
     | 
    
         
             
                else
         
     | 
| 
       255 
393 
     | 
    
         
             
                    puts "Invalid type, see psa help"
         
     | 
| 
         @@ -257,6 +395,10 @@ def do_purge(type, domain) 
     | 
|
| 
       257 
395 
     | 
    
         
             
            end
         
     | 
| 
       258 
396 
     | 
    
         | 
| 
       259 
397 
     | 
    
         
             
            def do_flush(type, domain)
         
     | 
| 
      
 398 
     | 
    
         
            +
                if "#{PS_MULTI_HOME}" != "false"
         
     | 
| 
      
 399 
     | 
    
         
            +
                    ENV['PS_CFG_HOME'] = "#{PS_MULTI_HOME}/#{domain}"
         
     | 
| 
      
 400 
     | 
    
         
            +
                end
         
     | 
| 
      
 401 
     | 
    
         
            +
             
     | 
| 
       260 
402 
     | 
    
         
             
                case type
         
     | 
| 
       261 
403 
     | 
    
         
             
                when "app"
         
     | 
| 
       262 
404 
     | 
    
         
             
                    do_cmd("#{PS_PSADMIN_PATH}/psadmin -c cleanipc -d #{domain}")
         
     | 
| 
         @@ -284,9 +426,9 @@ end 
     | 
|
| 
       284 
426 
     | 
    
         | 
| 
       285 
427 
     | 
    
         
             
            def do_pooladd(type, domain)
         
     | 
| 
       286 
428 
     | 
    
         
             
                if PS_POOL_MGMT == "on" then
         
     | 
| 
       287 
     | 
    
         
            -
                    # Change  
     | 
| 
      
 429 
     | 
    
         
            +
                    # Change PS_HEALTH_TEXT and PS_HEALTH_FILE variables to match your system
         
     | 
| 
       288 
430 
     | 
    
         
             
                    puts "Adding web domain to load balanced pool..."
         
     | 
| 
       289 
     | 
    
         
            -
                    do_cmd("echo ' 
     | 
| 
      
 431 
     | 
    
         
            +
                    do_cmd("echo '#{PS_HEALTH_TEXT}' > #{env('PS_CFG_HOME')}/webserv/#{domain}/applications/peoplesoft/PORTAL.war/#{PS_HEALTH_FILE}")
         
     | 
| 
       290 
432 
     | 
    
         
             
                    sleep(PS_HEALTH_TIME.to_i)
         
     | 
| 
       291 
433 
     | 
    
         
             
                    puts "...domain added to pool."
         
     | 
| 
       292 
434 
     | 
    
         
             
                    puts ""
         
     | 
| 
         @@ -297,13 +439,13 @@ end 
     | 
|
| 
       297 
439 
     | 
    
         | 
| 
       298 
440 
     | 
    
         
             
            def do_poolrm(type,domain)
         
     | 
| 
       299 
441 
     | 
    
         
             
                if PS_POOL_MGMT == "on" then
         
     | 
| 
       300 
     | 
    
         
            -
                    # Change  
     | 
| 
      
 442 
     | 
    
         
            +
                    # Change PS_HEALTH_TEXT and PS_HEALTH_FILE variables to match your system
         
     | 
| 
       301 
443 
     | 
    
         
             
                    puts "Removing domain from load balanced pool..."
         
     | 
| 
       302 
444 
     | 
    
         
             
                    case "#{OS_CONST}"
         
     | 
| 
       303 
445 
     | 
    
         
             
                    when "linux"
         
     | 
| 
       304 
446 
     | 
    
         
             
                        do_cmd("rm -f #{env('PS_CFG_HOME')}/webserv/#{domain}/applications/peoplesoft/PORTAL.war/#{PS_HEALTH_FILE}")
         
     | 
| 
       305 
447 
     | 
    
         
             
                    when "windows"
         
     | 
| 
       306 
     | 
    
         
            -
                        do_cmd("remove-item -force #{env('PS_CFG_HOME')}/webserv/#{domain}/applications/peoplesoft/PORTAL.war/#{PS_HEALTH_FILE}")
         
     | 
| 
      
 448 
     | 
    
         
            +
                        do_cmd("remove-item -force #{env('PS_CFG_HOME')}/webserv/#{domain}/applications/peoplesoft/PORTAL.war/#{PS_HEALTH_FILE} -ErrorAction SilentlyContinue")
         
     | 
| 
       307 
449 
     | 
    
         
             
                    else
         
     | 
| 
       308 
450 
     | 
    
         
             
                        puts " badOS - #{OS_CONST}"
         
     | 
| 
       309 
451 
     | 
    
         
             
                    end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,15 @@ 
     | 
|
| 
       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.7
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Kyle Benson
         
     | 
| 
      
 8 
     | 
    
         
            +
            - Dan Iverson
         
     | 
| 
       8 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2018-08-10 00:00:00.000000000 Z
         
     | 
| 
       12 
13 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       13 
14 
     | 
    
         
             
            description: A psadmin helper tool
         
     | 
| 
       14 
15 
     | 
    
         
             
            email: kyle@psadmin.io
         
     | 
| 
         @@ -17,8 +18,8 @@ executables: 
     | 
|
| 
       17 
18 
     | 
    
         
             
            extensions: []
         
     | 
| 
       18 
19 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       19 
20 
     | 
    
         
             
            files:
         
     | 
| 
       20 
     | 
    
         
            -
            - lib/psadmin_plus.rb
         
     | 
| 
       21 
21 
     | 
    
         
             
            - bin/psa
         
     | 
| 
      
 22 
     | 
    
         
            +
            - lib/psadmin_plus.rb
         
     | 
| 
       22 
23 
     | 
    
         
             
            homepage: https://github.com/psadmin-io/psadmin-plus
         
     | 
| 
       23 
24 
     | 
    
         
             
            licenses:
         
     | 
| 
       24 
25 
     | 
    
         
             
            - MIT
         
     | 
| 
         @@ -29,17 +30,17 @@ require_paths: 
     | 
|
| 
       29 
30 
     | 
    
         
             
            - lib
         
     | 
| 
       30 
31 
     | 
    
         
             
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
       31 
32 
     | 
    
         
             
              requirements:
         
     | 
| 
       32 
     | 
    
         
            -
              - -  
     | 
| 
      
 33 
     | 
    
         
            +
              - - ">="
         
     | 
| 
       33 
34 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       34 
35 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       35 
36 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       36 
37 
     | 
    
         
             
              requirements:
         
     | 
| 
       37 
     | 
    
         
            -
              - -  
     | 
| 
      
 38 
     | 
    
         
            +
              - - ">="
         
     | 
| 
       38 
39 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       39 
40 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       40 
41 
     | 
    
         
             
            requirements: []
         
     | 
| 
       41 
42 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       42 
     | 
    
         
            -
            rubygems_version: 2. 
     | 
| 
      
 43 
     | 
    
         
            +
            rubygems_version: 2.6.12
         
     | 
| 
       43 
44 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       44 
45 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       45 
46 
     | 
    
         
             
            summary: psadmin plus
         
     |