$ ! --------------------------------------------------------------------------- $ ! Start/Stop Script for the CATALINA Server $ ! $ ! $ ! Environment Variable Prequisites $ ! $ ! P1 CATALINA_HOME May point at your Catalina "build" directory. $ ! $ ! P2 CATALINA_BASE (Optional) Base directory for resolving dynamic portions $ ! of a Catalina installation. If not present, resolves to $ ! the same directory that CATALINA_HOME points to. $ ! $ ! P3 JAVA_HOME Must point at your Java Development Kit installation. $ ! $ ! P4 jpda If set, java is run in debug mode $ ! $ ! P5 JPDA_TRANSPORT (Optional) JPDA transport used when the "jpda start" $ ! command is executed. The default is "dt_shmem". $ ! $ ! P6 JPDA_ADDRESS (Optional) Java runtime options used when the "jpda start" $ ! command is executed. The default is "jdbconn". $ ! $ ! P7 run/stop The command either to stop/start the server $ ! $ ! $ ! Setting up tomcat5 and jdk env vars $ ! $ $! Get our PID (used for temporary files) $ userpid = f$getjpi("", "PID") $ $ CATALINA_HOME = "." $ if (f$edit(P1, "LOWERCASE") .nes. "") $ then $ CATALINA_HOME = P1 $ endif $ $ CATALINA_BASE = CATALINA_HOME $ if (f$edit(P2, "LOWERCASE") .nes. "") $ then $ CATALINA_BASE = P2 $ endif $ $ JDK_HOME = P3 $ $ CATALINA_BIN = "''CATALINA_HOME'/bin" $ CATALINA_TMPDIR = "''CATALINA_BASE'/temp" $ $ ! Convert the tomcat home directory into vms spec $ ! $ unix_spec = CATALINA_HOME $ gosub UnixtoVMS $ catalina_bin_vms = vms_dev_spec + vms_dir_spec -"]" + ".bin]" $ unix_spec = CATALINA_BASE $ gosub UnixtoVMS $ catalina_tmpdir_vms = vms_dev_spec + vms_dir_spec -"]" + ".temp]" $ $ ! write sys$output "''catalina_bin_vms'" $ set def 'catalina_bin_vms' $ ! Setup the jdk environment $ ! $ if (f$edit(P4, "LOWERCASE") .eqs. "jpda") $ then $ @'catalina_bin_vms'tomcat$setup_java.com $ else $ @'catalina_bin_vms'tomcat$setup_java.com fast $ endif $ $ !----- Execute The Requested Command --------------------------------------- $ $ write sys$output "Using CATALINA_BASE: ''CATALINA_BASE'" $ write sys$output "Using CATALINA_HOME: ''CATALINA_HOME'" $ write sys$output "Using CATALINA_TMPDIR: ''CATALINA_TMPDIR'" $ write sys$output "Using JAVA_HOME: ''JDK_HOME'" $ $ MAINCLASS = "org.apache.catalina.startup.Bootstrap" $ ACTION = "start" $ $ JPDA = "" $ if (f$edit(P4, "LOWERCASE") .eqs. "jpda") $ then $ JPDA = "jpda" $ endif $ $ JPDA_TRANSPORT = "dt_shmem" $ if (f$edit(P5, "LOWERCASE") .nes. "") $ then $ JPDA_TRANSPORT = P5 $ endif $ $ JPDA_ADDRESS = "jdbconn" $ if (f$edit(P6, "LOWERCASE") .nes. "") $ then $ JPDA_ADDRESS = P6 $ endif $ $ if (f$edit(P7, "LOWERCASE") .eqs. "run") then goto doRun $ if (f$edit(P7, "LOWERCASE") .eqs. "stop") then goto doStop $ write sys$output "Usage: catalina ( commands ... )" $ write sys$output "run Start Catalina in the current window" $ write sys$output "stop Stop Catalina" $ goto done $ $ doRun: $ ACTION = "start" $ goto execCmd $ $ doStop: $ ACTION = "stop" $ goto execCmd $ $ execCmd: $ write sys$output "Execute Java with the applicable properties" $ gosub create_cmd_file $ java "-V" 'cmd_filename' $ delete 'cmd_filename'; $ goto done $ $!================================================================================== $ create_cmd_file: $ cmd_filename == "''catalina_tmpdir_vms'nbtomcat" + userpid + ".dat" $ if f$search("''cmd_filename'", 1) .nes. "" $ then $ delete 'cmd_filename';* $ endif $ open/write cmd_file 'cmd_filename' $ $ write cmd_file "-classpath ''catalina_home'/bin/bootstrap.jar:''JDK_HOME'/lib/tools.jar" $ if JPDA .nes. "" $ then $ write cmd_file "-Xdebug -Xrunjdwp:transport=''JPDA_TRANSPORT',address=''JPDA_ADDRESS',server=y,suspend=n" $ endif $ write cmd_file "-Dcatalina.base=''catalina_base'" $ write cmd_file "-Dcatalina.home=''catalina_home'" $ write cmd_file "-Djava.io.tmpdir=''catalina_tmpdir'" $ write cmd_file "-Djava.endorsed.dirs=''catalina_home'/common/endorsed" $ write cmd_file "''MAINCLASS'" $ write cmd_file "''ACTION'" $ close/nolog cmd_file $ return $ $!================================================================================== $ UnixtoVMS: $ vms_dev_spec = f$element(1, "/", unix_spec) + ":" $ vms_dir_spec = "" $ vms_file_spec = "" $ element_count = 2 $parse_loop: $ vms_dir_element = f$element(element_count, "/", unix_spec) $ if ((vms_dir_element .eqs. "/") .or. (vms_dir_element .eqs. "")) then goto done_parse $ if (f$locate(".", vms_dir_element) .ne. f$length(vms_dir_element)) $ then $ vms_file_spec = vms_dir_element $ goto done_parse $ endif $ if (vms_dir_spec .nes. "") $ then $ vms_dir_spec = vms_dir_spec + "." + vms_dir_element $ else $ vms_dir_spec = vms_dir_element $ endif $ element_count = element_count + 1 $ if (element_count .ge. 50) then goto done_parse $ goto parse_loop $done_parse: $ vms_dir_spec = "[" + vms_dir_spec + "]" $ return $ $ done: $ exit