:: next_line_is_templatized
::File:StartApache.cmd
:: disable the echo
@echo off
:: this is part of the name of the file - not used
set Action=start
:: which component are we going to start
set Component=apache
:: the name of the Product next_line_is_templatized
set ProductName=morphus
:: the version of the current Product next_line_is_templatized
set ProductVersion=1.1.3
:: could be dev , test , dev , prod next_line_is_templatized
set ProductType=dev
:: who owns this Product / environment next_line_is_templatized
set ProductOwner=ysg
:: identifies an instance of the tool ( new instance for this version could be created by simply changing the owner )
set EnvironmentName=%ProductName%.%ProductVersion%.%ProductType%.%ProductOwner%
:: where the Apache binaries are installed
set ApacheBinDir="C:\Program Files (x86)\Apache Software Foundation\Apache2.2\"
:: the full path to the Apache binary
set ApacheBin="C:\Program Files (x86)\Apache Software Foundation\Apache2.2\bin\httpd.exe"
:: the full path to the http.conf
set HttpdConf="C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf\httpd.conf"
:: the full path to the
set ApacheWorkingDir="C:\Program Files (x86)\Apache Software Foundation\Apache2.2\."
:: go the run dir
cd %~dp0
:: do 4 times going up
for /L %%i in (1,1,5) do pushd ..
:: The BaseDir is 4 dirs up than the run dir
set ProductBaseDir=%CD%
:: debug echo BEFORE ProductBaseDir is %ProductBaseDir%
:: remove the trailing \
IF %ProductBaseDir:~-1%==\ SET ProductBaseDir=%ProductBaseDir:~0,-1%
:: debug echo AFTER ProductBaseDir is %ProductBaseDir%
:: debug pause
:: The version directory of the Product
set ProductVersionDir=%ProductBaseDir%\%ProductName%\%EnvironmentName%
:: where the error logs of this call are situated
set ErrorLog=%ProductVersionDir%\data\log\StartApache.cmd.Error.%ProductName%.cmd.log
:: where the running of this
set RunLog=%ProductVersionDir%\data\log\StartApache.cmd.%ProductName%.cmd.log
:: define a favorite editor
set MyEditor=textpad
ECHO Check the variables
:: truncate the run log
echo date is %date% time is %time% > %RunLog%
:: truncate the error log
echo date is %date% time is %time% > %ErrorLog%
:: uncomment this to debug all the vars
:: debug set >> %RunLog%
:: go to the Apache bin dir
cd %ApacheBinDir%
:: now open the run log
cmd /c start /max %MyEditor% %RunLog%
:: Action !!!
echo CFPoint1 OK The run cmd script %0 is executed >> %RunLog%
echo CFPoint2 OK The run cmd script %0 starts the apache binary with STDOUT and STDERR to a single RunLog file >> %RunLog%
:: perl %PerlScript% %IniFile% >>%RunLog%
%ApacheBin% -w -f %HttpdConf% -d %ApacheWorkingDir% >>%RunLog% 2>&1
:: open the run log
cmd /c start /max %MyEditor% %RunLog%
:: uncomment this line to wait for 5 seconds
:: ping localhost -n 5
:: uncomment this line to see what is happening
:: PAUSE
:: Requirements:
:: This script requires perl , text editor supporting <<textEditor>> <<FileNameToOpen>> cmd call syntax
:: VersionHistory
:: 0.1.0 --- ysg --- Initial creation copy from run-morphus