[0001]
[0002]
[0003]
[0004]
[0005]
[0006]
[0007]
[0008]
[0009]
[0010]
[0011]
[0012]
[0013]
[0014]
[0015]
[0016]
[0017]
[0018]
[0019]
[0020]
[0021]
[0022]
[0023]
[0024]
[0025]
[0026]
[0027]
[0028]
[0029]
[0030]
[0031]
[0032]
[0033]
[0034]
[0035]
[0036]
[0037]
[0038]
[0039]
[0040]
[0041]
[0042]
[0043]
[0044]
[0045]
[0046]
[0047]
[0048]
[0049]
[0050]
[0051]
[0052]
[0053]
[0054]
[0055]
[0056]
[0057]
[0058]
[0059]
[0060]
[0061]
[0062]
[0063]
[0064]
[0065]
[0066]
[0067]
[0068]
[0069]
[0070]
[0071]
[0072]
[0073]
[0074]
[0075]
[0076]
[0077]
[0078]
[0079]
[0080]
[0081]
[0082]
[0083]
[0084]
[0085]
[0086]
[0087]
[0088]
[0089]
[0090]
[0091]
[0092]
[0093]
[0094]
[0095]
[0096]
[0097]
[0098]
[0099]
[0100]
[0101]
[0102]
[0103]
[0104]
[0105]
[0106]
[0107]
[0108]
[0109]
[0110]
[0111]
[0112]
[0113]
[0114]
[0115]
[0116]
[0117]
[0118]
[0119]
[0120]
[0121]
[0122]
[0123]
[0124]
[0125]
[0126]
[0127]
[0128]
[0129]
[0130]
[0131]
[0132]
[0133]
[0134]
[0135]
[0136]
[0137]
[0138]
[0139]
[0140]
[0141]
[0142]
[0143]
[0144]
[0145]
[0146]
[0147]
[0148]
[0149]
[0150]
[0151]
[0152]
[0153]
[0154]
[0155]
[0156]
[0157]
[0158]
[0159]
[0160]
[0161]
[0162]
[0163]
[0164]
[0165]
[0166]
[0167]
[0168]
[0169]
[0170]
[0171]
[0172]
[0173]
[0174]
[0175]
[0176]
[0177]
[0178]
[0179]
[0180]
[0181]
[0182]
[0183]
$!-----------------------------------------------------------------------------
$! STARTUP_SERVER.COM
$!
$! This procedure provides for the startup and execution of the HTTP server.
$! It is designed to support a single server process on a single node, single
$! server processes on separate nodes within a cluster, and multiple server
$! processes within a single node, and of course, a combination of the latter
$! two.  Modification is only necessary if any one server will be supporting
$! a service or services different to any other within a cluster or single
$! system.  If multiple nodes within a cluster provide the same service(s)
$! modification is not required.  For supporting multiple server processes on
$! the one system some modification is required.
$!
$! DO NOT MODIFY THIS PROCEDURE!
$! *****************************
$!
$! To create a site-specific server process startup file copy this to
$! STARTUP_SERVER_LOCAL.COM in the same directory.  Make modifications to that
$! version, not to the original.
$!
$! To create node/port-specific server process startup file copy this to
$! STARTUP_SERVER_node_port.COM or STARTUP_SERVER_node.COM depending if the
$! granularity is required down to port level or just node level.
$!
$! The STARTUP.COM procedure, when executing on any one node, searches for
$! these files, executing the appropriate one when creating and maintaining
$! the detached server process.
$!
$! Ensure the HTTP$SERVER account has R+E permission to any such procedures!
$! Also remember these procedures are executed in the HTTP$SERVER unprivileged
$! account context and so can only be used for job-level purposes, etc.
$!
$! Parameters to be passed to the HTTPD executable may be delivered by creating
$! a logical beginning "WASD_" (pre-v10.0, "HTTPD$") and then continued with
$! the procedure's name, i.e. "HTTPD$STARTUP_SERVER_node_port". 
$!
$! If the parameters are not hard-wired this logical will be translated with
$! each server startup and the value used as the executable's command line.
$! A system-level logical is best defined in the STARTUP_LOCAL.COM procedure.
$! A job-level logical is best defined in STARTUP_SERVER_LOCAL.COM procedure.
$!
$! Copyright (C) 1996-2021 Mark G.Daniel.
$!
$! Licensed under the Apache License, Version 2.0 (the "License");
$! you may not use this file except in compliance with the License.
$! You may obtain a copy of the License at
$!
$!    http://www.apache.org/licenses/LICENSE-2.0
$!
$! Unless required by applicable law or agreed to in writing, software
$! distributed under the License is distributed on an "AS IS" BASIS,
$! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
$! See the License for the specific language governing permissions and
$! limitations under the License.
$!
$! VERSION HISTORY
$! ---------------
$! 06-OCT-2017  MGD  set process/dump (happy 93rd birthday Dad)
$! 11-JUL-2009  MGD  v10 and pre-v10 logical names
$!                   WASD autonomous environments
$! 19-JUL-2003  MGD  network mode server process
$! 15-OCT-2002  MGD  reset error count after HTTPd SUCCESS exit
$! 25-JUL-2001  MGD  'STATUS=$STATUS' suggested by didier.morandi@gmx.ch
$! 25-SEP-2000  MGD  allow for STARTUP_SERVER_LOCAL.COM
$! 01-NOV-1998  MGD  initial, v5.3
$!-----------------------------------------------------------------------------
$!
$! set verify
$ set noon
$ ss$_duplnam = 148
$ httpd_parameters = ""
$!
$ procedure = f$environment("procedure")
$ procedure_name = f$parse(procedure,,,"name")
$ logfile = procedure_name - "startup_server_" - "startup_server"
$ if logfile .eqs. "" then logfile = f$edit(f$getsyi("nodename"),"collapse")
$ logfile = "WASD_SERVER_LOGS:" + logfile + ".LOG"
$!
$!(retrieve any parameters from the server startup logical name)
$ logical_name = "WASD_" + procedure_name
$ pre10_logical_name = "HTTPD$" + procedure_name
$ if f$trnlnm(logical_name) .eqs. "" .and. -
     f$trnlnm(pre10_logical_name) .nes. "" then -
        logical_name = pre10_logical_name
$ logical_params = f$trnlnm(logical_name)
$!
$!(env number is necessary to set up the correct WASD_TABLE into LNM$FILE_DEV)
$ prcnam = f$edit(f$getjpi("","prcnam"),"collapse")
$ wasd_env = f$integer(f$extract(0,2,prcnam))
$ if wasd_env .eq. 0 then wasd_env = f$integer(f$extract(0,1,prcnam))
$ if wasd_env .gt. 15
$ then
$    write sys$output "%STARTUP_SERVER-E-ENV, number out-of-range"
$    exit %X10000014
$ endif
$ if wasd_env .eq. 1 then wasd_env = 0
$!
$!(set up process' LNM$_FILE_DEV for v10.0 and later)
$ wasd_file_dev = "WASD_FILE_DEV"
$ if wasd_env .ge. 2 then -
     wasd_file_dev = wasd_file_dev + "_" + f$string(wasd_env)
$ if f$trnlnm(wasd_file_dev) .nes. ""
$ then
$    if wasd_env .ge. 2
$       then @'wasd_file_dev' 'wasd_env'
$       else @'wasd_file_dev'
$    endif
$ endif
$!
$ if f$mode() .eqs. "BATCH" then goto mode_batch
$ if f$mode() .eqs. "OTHER" then goto mode_other_network
$ if f$mode() .eqs. "NETWORK"
$ then
$    purge /nolog /keep=3 SYS$LOGIN:STARTUP_SERVER.LOG
$    open /write /share=write sys_net SYS$NET
$    define sys$output sys_net
$    goto mode_other_network
$ endif
$ exit
$!
$!-----------------------------------------------------------------------------
$ mode_batch:
$!
$ purge /keep=3 'logfile'
$ run SYS$SYSTEM:LOGINOUT /input='procedure' /output='logfile' -
                          /detached /authorize
$ exit
$!
$!-----------------------------------------------------------------------------
$ mode_other_network:
$!
$ if f$trnlnm("WASD_HTTPD_EXE") .nes. ""
$    then httpd = "$WASD_HTTPD_EXE"
$    else httpd = "$HTTPD$EXE"
$ endif
$!
$ error_count = 0
$!
$ httpd_loop:
$!
$    params = httpd_parameters
$    if params .eqs. ""
$    then
$       logical_params = f$trnlnm(logical_name)
$!      (ensure enough quotes for command-line substitution)
$       params = f$element(0,"""",logical_params)
$       count = 1
$       quote_loop:
$          part = f$element(count,"""",logical_params)
$          if part .eqs. """" then goto end_quote_loop
$          params = params + """" + part
$          count = count + 1
$          goto quote_loop
$       end_quote_loop:
$    endif
$    if wasd_env .ge. 2 then params = params + "/ENV=" + f$string(wasd_env)
$    set process /dump
$!
$    set verify
$ httpd /priority=4 'params'
$!   'f$verify(0)
$!
$!   (non-error exit, must be a restart, loop immediately)
$    status = $status
$    if status
$    then
$       error_count = 0
$       goto httpd_loop
$    endif
$    if status .eq. ss$_duplnam then exit
$!
$    error_count = error_count + 1
$    if error_count .lt. 120
$       then wait 00:00:15
$       else wait 00:15:00
$    endif
$    goto httpd_loop
$!
$!end_httpd_loop:
$!
$ exit
$!-----------------------------------------------------------------------------