$!----------------------------------------------------------------------------- $! 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 $!-----------------------------------------------------------------------------