$!----------------------------------------------------------------------------- $! WCME_STARTUP.COM $! $! To start WCME as a detached process this procedure should be executed with $! P1 the account name for WCME to execute under. This account must have $! permission to read and execute this procedure. $! $! P2 allows either the "WASD" or "APACHE" environment to be specified. $! When empty; if the logical name "WASD_ROOT" exists the default becomes $! a WASD enviornment, or if "APACHE$ROOT" exists becomes VMS Apache. $! $! P3 allows SYS$OUTPUT to be specified and be a file-system specification $! somewhere the account has permission to write. $! $! To have relevant logical names automatically defined then assign local $! symbols before calling the procedure. For example: $! $! $ WCME_CERT = "WASD_ROOT:[LOCAL]" $! $ WCME_MAIL = "SYSTEM,mark.daniel@wasd.vsm.com.au" $! $ WCME_OPCOM = "CENTRAL,OPER2" $! $ @WASD_ROOT:[SRC.WMCE]WCME_STARTUP.COM SYSTEM WASD $! $! Symbols supported in this fashion: $! $! WCME_CACERT certificate authority bundle $! WCME_CERT server certificate(s) location (can have 1 or 2 values) $! WCME_HTTP01 use the standalone http-01 challenge server $! WCME_LOAD action to load renewed certificate (can have 1 or 2 values) $! WCME_MAIL reporting email address(es) $! WCME_OPCOM reporting OPCOM destination(s) $! WCME_ROOT overrides default location for WCME_ROOT logical name $! $! Logical name values containing quotation marks must be escaped (doubled-up). $! $! 16-JUL-2017 MGD add WCME_HTTP01 $! 07-MAY-2017 MGD initial $!----------------------------------------------------------------------------- $! $ p1 = f$edit(p1,"upcase") $ p2 = f$edit(p2,"upcase") $ p3 = f$edit(p3,"upcase") $! $ if f$trnlnm("WASD_FILE_DEV") .nes. "" then @wasd_file_dev $! $ if P1 .nes. "" $ then $! $! ************* $! * startup * $! ************* $! $ on error then continue $ procedure = f$element(0,";",f$environment("procedure")) $ write sys$output f$fao("!#*>", 78-f$length(procedure)) + " " + procedure $! $ if P1 .nes. "*" $ then $! $ if P1 .eqs. "" $ then $ write sys$output "%WCME-E-STARTUP, P1 must be account name" $ exit 44 $ endif $! $ endif $! $ if P2 .eqs. "" $ then $ if f$trnlnm("WASD_ROOT") .nes. "" then P2 = "WASD" $ if (P2 .eqs. "" .and. f$trnlnm("APACHE$ROOT") .nes. "") - then P2 = "APACHE" $ endif $! $ if P2 .eqs. "WASD" $ then $ wasd_root = f$trnlnm("WASD_ROOT") $ if wasd_root .eqs. "" then exit 44 $ if f$type(WCME_ROOT) .eqs. "" then - wcme_root = wasd_root - ".]" + ".LOCAL.WCME.]" $ script = "CGI-BIN:[000000]WCME.EXE" $ image = "CGI-BIN:[000000]WCME.EXE" $ endif $! $ if P2 .eqs. "APACHE" $ then $ apache_common = f$trnlnm("APACHE$COMMON") $ if apache_common .eqs. "" then exit 44 $ if f$type(WCME_ROOT) .eqs. "" then - wcme_root = apache_common - ".]" + ".WCME.]" $ script = "APACHE$ROOT:[CGI-BIN]WCME.EXE" $ image = "APACHE$ROOT:[CGI-BIN]WCME.EXE" $ endif $! $ if P2 .nes. "WASD" .and. P2 .nes. "APACHE" then exit 44 $! $ define /system /trans=concealed /executive /nolog WCME_ROOT 'wcme_root' $ if f$length(f$search("WCME_ROOT:[000000]*.*")) .eq. 0 then exit 44 $! $ if f$type(WCME_CACERT) .eqs. "" then - wcme_cacert = "WCME_ROOT:[ETC]CACERT.PEM" $! $ if f$type(WCME_CACERT) .nes. "" then - define /system /executive /nolog WCME_CACERT "''WCME_CACERT'" $ if f$type(WCME_CERT) .nes. "" $ then $ if f$element(1,",",WCME_CERT) .eqs. "," $ then $ define /system /executive /nolog WCME_CERT "''WCME_CERT'" $ else $ define /system /executive /nolog WCME_CERT - "''f$element(0,",",WCME_CERT)'",- "''f$element(1,",",WCME_CERT)'" $ endif $ endif $ if f$type(WCME_HTTP01) .nes. "" then - define /system /executive /nolog WCME_HTTP01 "''WCME_HTTP01'" $ if f$type(WCME_LOAD) .nes. "" $ then $ if f$element(1,",",WCME_LOAD) .eqs. "," $ then $ define /system /executive /nolog WCME_LOAD "''WCME_LOAD'" $ else $ define /system /executive /nolog WCME_LOAD - "''f$element(0,",",WCME_LOAD)'",- "''f$element(1,",",WCME_LOAD)'" $ endif $ endif $ if f$type(WCME_MAIL) .nes. "" then - define /system /executive /nolog WCME_MAIL "''WCME_MAIL'" $ if f$type(WCME_OPCOM) .nes. "" then - define /system /executive /nolog WCME_OPCOM "''WCME_OPCOM'" $! $ define /system /executive /nolog WCME_IMAGE 'image' $ if f$file(script,"known") then INSTALL REMOVE 'script' $ INSTALL ADD 'script' /PRIV=(IMPERSONATE,SYSPRV) $! $ if P1 .nes. "*" $ then $ mcr 'image' /wcme=detach='procedure','P3','P1',"WCME-startup" $ endif $! $ write sys$output f$fao("!#*<", 78-f$length(procedure)) + " " + procedure $ exit $! $ endif $! $ if f$mode() .nes. "OTHER" $ then $ type sys$input Usage: @WCME_STARTUP.COM [] [] $ exit $ endif $! $! ************** $! * detached * $! ************** $! $ wcme = f$trnlnm("WCME_IMAGE","LNM$SYSTEM") $ if wcme .eqs. "" then exit 44 $ wcme = "$" + wcme $ wcme_loop: $ on error then continue $ wcme /overseer $ status = $status $! (if exiting without an error then just restart) $ if status then goto wcme_loop $! (if a stop/image or equivalent has been performed just restart) $ if status .eq. %X00002BDC then goto wcme_loop $! (if a bugcheck exit then try again shortly) $ set process /name="WCME-''status'" $ wait 00:01:00 $ goto wcme_loop $ end_wcme_loop: $! $!-----------------------------------------------------------------------------