Forum

Batch file for Windows

Matthias Diener
16 May 2007, 01:08
Hi Hugo,
your Server is running well, it's great work. I got it on my linux box and have a portable Version on my USB-Stick. I changed your Windows Startup file a little bit, that I must not care for the given drive letter:

@ECHO OFF

set HD=%CD:~0,1%
set BASE_PATH=%CD:~3%
set BASE_PATH=%HD%/%BASE_PATH:\=/%

echo set PREFIX = /cygdrive/%BASE_PATH% > %CD%\config\httpd.conf
echo Include /cygdrive/%BASE_PATH%/config/httpd.srv.conf >> %CD%\config\httpd.conf

%CD%\bin\wigwam.exe -q -c %CD%\config
IF ERRORLEVEL 1 GOTO ERROR
start %CD%\bin\hiawatha.exe -d -c %CD%\config
GOTO END

:ERROR
PAUSE

:END


The httpd.conf is created by this script and the original httpd.conf was renamed by me to httpd.srv.conf.
Further all log files directives must be given in httpd.srv.conf and The path should be replaced with e.g.: "PREFIX/log/access,log"

regards Matthias Diener
Hugo Leisink
16 May 2007, 10:50
Hi Matthias, thanks for the feedback. That's some advanced BATCH scripting. I will take a look at it and see if I can use it as the default startup batchfile

Thanks,
Hugo
Matthias Diener
25 May 2007, 14:53
Hi Hugo,
well it's just an idea for portable usage, but must not be the standard. I just thought that some other could be interesed in using it that way too.
Matthias
Matthias Diener
25 May 2007, 14:56
s/must not/there is no need to/

..bad translation fault form german, it sure may be standard at all
Red
9 September 2007, 17:35
Besides the advanced batch scripting, could you please insert the next line in the batch startup:
...
%CD%\bin\wigwam.exe -q -c %CD%\config
IF ERRORLEVEL 1 GOTO ERROR
start %CD%\bin\hiawatha.exe -d -c %CD%\config
IF ERRORLEVEL 1 GOTO ERROR
GOTO END
...

In my case Skype took already port 80, so the DOS-box disappeared after startup. After closing Skype, it worked
Hugo Leisink
10 September 2007, 01:34
Good one. Thanks!
Klemens Häckel
21 November 2007, 20:46
Very good tip.

Combining with what i had already started, i am currently using the batch file:
@ECHO OFF

%CD%\bin\wigwam.exe -q -c %CD%\config
IF ERRORLEVEL 1 GOTO ERRORCFG
start %CD%\bin\hiawatha.exe -d -c %CD%\config
IF ERRORLEVEL 1 GOTO ERROR
GOTO END

:ERRORCFG
echo configuration problem
:ERROR
PAUSE

:END


and i am using almost the original httpd.conf file, except for some hacks, since i don't use the "..Program Files" - location:
changed SystemLogfile, AccesslogFile, ErrorLogfile, WebsiteRoot
to
SystemLogfile = /apps/Hiawatha/log/system.log
AccesslogFile = /apps/Hiawatha/log/access.log
ErrorLogfile = /apps/Hiawatha/log/error.log
WebsiteRoot = /apps/wwwroot


I still get the same error message (as i have when using the other bathc file):
Warning: can't write PID file /cygdrive/c/Program Files/Hiawatha/log/hiawatha.pid.

but seems to work anyway, even with a simple php script, and i hope with some more complex php too.

greetings
Hugo Leisink
22 November 2007, 08:22
About the error message: use the PIDfile option to change the location of the PID file. See the manualpage for more information about this setting.
This topic has been closed.