|
From: <da...@ix...> - 2003-09-26 18:20:58
|
The newer Wrapper binaries, with the -t|-p support to start|stop NT
services is great (actually solved a problem for us last night).
However, having to take a config file option is a bit of a nuissance.
Especially since we already have the config file set up in the .bat file.
So, has there been any thought given to enhancing the .bat file to allow
{start|stop|console} to work the same as it does with the Unix script?
Right now the Unix and NT scripts behave differently. The Unix script only
takes a single action parameter, while the NT script only takes a single
configuration file parameter.
I'd really like to propose that they come closer to performing similarly.
I think it'd be fairly easy to enhance both to take 2 parameters, the first
being one of {start|stop|console} and the optional second being a config
file.
I'm not sure what to do about dump on the NT side. Help?
Anyway, I know this would be a big change for the NT script side, but, do
many people actually use the feature of the .bat file taking a config file
as a parm? Would such a change break many people?
What about if, for a while, on the NT side, if the first param is not one
of {start|stop|console|dump} that a warning is issued, and the param is
used as a config file. Then some later release, the {start|stop|console}
becomes mandatory?
Internally I will probably be making these changes anyway, but if the
Wrapper community has any thoughts on an approach they would accept, I'd be
willing to design towards that end.
Cheers,
mrc
--
Mike Castle da...@ix... www.netcom.com/~dalgoda/
We are all of us living in the shadow of Manhattan. -- Watchmen
fatal ("You are in a maze of twisty compiler features, all different"); -- gcc
|
|
From: <da...@ix...> - 2003-09-28 19:00:03
|
In article <5gc...@th...>,
Mike Castle <wra...@li...> wrote:
>What about if, for a while, on the NT side, if the first param is not one
>of {start|stop|console|dump} that a warning is issued, and the param is
>used as a config file. Then some later release, the {start|stop|console}
>becomes mandatory?
Hmmmm.... Does anyone use wrapper in a non-NT, but Win32 environment?
In looking at the App.bat.in, I see all code paths goes to this line:
:conf
set _WRAPPER_CONF="%~f1"
But I thought the ~f stuff was NT only. Am I mistaken?
Just realized I may have to target any enhancements that I do to Win98 and
company, which could be annoying.
mrc
--
Mike Castle da...@ix... www.netcom.com/~dalgoda/
We are all of us living in the shadow of Manhattan. -- Watchmen
fatal ("You are in a maze of twisty compiler features, all different"); -- gcc
|
|
From: <da...@ix...> - 2003-10-01 20:32:11
|
In article <kd9...@th...>,
Mike Castle <wra...@li...> wrote:
>In article <5gc...@th...>,
>Mike Castle <wra...@li...> wrote:
>>What about if, for a while, on the NT side, if the first param is not one
>>of {start|stop|console|dump} that a warning is issued, and the param is
>>used as a config file. Then some later release, the {start|stop|console}
>>becomes mandatory?
>
>Hmmmm.... Does anyone use wrapper in a non-NT, but Win32 environment?
>
>In looking at the App.bat.in, I see all code paths goes to this line:
>
>:conf
>set _WRAPPER_CONF="%~f1"
>
>But I thought the ~f stuff was NT only. Am I mistaken?
So, I finished writing up a possible new App.cmd.in file.
@echo off
setlocal
rem
rem Find the application home.
rem
rem %~dp0 is name of current script under NT
set _APP_HOME=%~dp0
rem : operator works similar to make : operator
set _APP_HOME=%_APP_HOME:\bin\=%
set _WRAPPER_EXE=%_APP_HOME%\bin\Wrapper.exe
rem Find the requested command.
for /F %%v in ('echo %1^|findstr "^console$ ^start$ ^stop$ ^restart$
^install$ ^remove"') do call :exec set COMMAND=%%v
if "%COMMAND%" == "" (
echo WARNING: Defaulting to running in console mode is deprecated. 1>&2
set COMMAND=console
) else (
shift
)
rem
rem Find the wrapper.conf
rem
:conf
set _WRAPPER_CONF="%~f1"
if not %_WRAPPER_CONF%=="" goto startup
set _WRAPPER_CONF="%_APP_HOME%\conf\wrapper.conf"
rem
rem Run the application.
rem At runtime, the current directory will be that of Wrapper.exe
rem
if not exist "%_APP_HOME%\logs" mkdir "%_APP_HOME%\logs"
call :%COMMAND%
if errorlevel 1 pause
goto :eof
:console
echo on
"%_WRAPPER_EXE%" -c %_WRAPPER_CONF%
goto :eof
:start
"%_WRAPPER_EXE%" -t %_WRAPPER_CONF%
goto :eof
:stop
"%_WRAPPER_EXE%" -p %_WRAPPER_CONF%
goto :eof
:install
"%_WRAPPER_EXE%" -i %_WRAPPER_CONF%
goto :eof
:remove
"%_WRAPPER_EXE%" -r %_WRAPPER_CONF%
goto :eof
:restart
call :stop
call :start
goto :eof
:exec
%*
goto :eof
Since the old App.bat.in used NT specific features in the main line anyway,
and since no one complained about it not working on 9x, I made the
assumption that no one is actually using Wrapper in a non-NT environment.
Therefore, I decided to it completely NT specific.
Unfortunately I don't have an NT4.0 handy, so I hope it still works on
that. I don't think I used any 2K specific features.
I renamed the file from .bat to .cmd to reflect the NT specific nature of
the file.
I used setlocal to avoid having to undef envvars at the end of the script.
It now supports console|start|stop|restart|install|remove, so it's now very
similar to the Unix script. Note that the Unix script still supports the
dump command, and the NT script supports install and remove. Regarding
dump via NT service, I think the another thread addresses that issue and
may give room for thought.
With this script, the extra install/uninstall scripts are no longer
necessary.
I'm still undecided about remove versus uninstall for the command.
Actually no reason it can't be both.
The Unix script can stop one started via console; the NT script cannot.
The Unix script currently does not handle taking a second parameter to use
as a config file. I think that if the NT one does, then the Unix one
should be similarly enhanced.
Still not sure about the whole deprecated message. No feed back from the
list on that design point. I think both platforms should function
similarly, and if the Unix script requires a command, then the NT one
should.
Enjoy!
mrc
--
Mike Castle da...@ix... www.netcom.com/~dalgoda/
We are all of us living in the shadow of Manhattan. -- Watchmen
fatal ("You are in a maze of twisty compiler features, all different"); -- gcc
|
|
From: Leif M. <le...@ta...> - 2003-10-03 17:54:59
|
Mike,
Thanks for all the work you put into this and sorry for the slow response.
Here are my thoughts on this. I want to keep the existing batch files around
to give the users options. But personally, I think I will start using
your new
script. It looks great.
I am planning to add the new batch file as src/bin/AppCommand.bat.in
I am not totally happy with the name. Do you have any other ideas.
I don't really see any reason to put in the deprecated code as this will be
a new script. I know you were planning to replace the old script, so it
would
have been valid.
I also removed the code to create the logs directory. Its location will
depend on the configuration in the wrapper.conf file so it can't be hard
coded into the batch file. There has been a feature request to create the
batch file if it does not exist for a while, so I'll try to get that
implemented
in a cross platform way for the next release.
The batch file that I committed, with the above changes can be found at
the end of this mail. Let me know if you have any other suggestions. From
my testing so far, it looks great though. Good work.
Cheers,
Leif
@echo off
setlocal
rem
rem Find the application home.
rem
rem %~dp0 is name of current script under NT
set _REALPATH=%~dp0
set _WRAPPER_EXE=%_REALPATH%Wrapper.exe
rem Find the requested command.
for /F %%v in ('echo %1^|findstr "^console$ ^start$ ^stop$ ^restart$
^install$ ^remove"') do call :exec set COMMAND=%%v
if "%COMMAND%" == "" (
echo Usage: %0 { console : start : stop : restart : install : remove }
pause
goto :eof
) else (
shift
)
rem
rem Find the wrapper.conf
rem
:conf
set _WRAPPER_CONF="%_REALPATH%..\conf\wrapper.conf"
rem
rem Run the application.
rem At runtime, the current directory will be that of Wrapper.exe
rem
call :%COMMAND%
if errorlevel 1 pause
goto :eof
:console
echo on
"%_WRAPPER_EXE%" -c %_WRAPPER_CONF%
goto :eof
:start
"%_WRAPPER_EXE%" -t %_WRAPPER_CONF%
goto :eof
:stop
"%_WRAPPER_EXE%" -p %_WRAPPER_CONF%
goto :eof
:install
"%_WRAPPER_EXE%" -i %_WRAPPER_CONF%
goto :eof
:remove
"%_WRAPPER_EXE%" -r %_WRAPPER_CONF%
goto :eof
:restart
call :stop
call :start
goto :eof
:exec
%*
goto :eof
|
|
From: Leif M. <le...@ta...> - 2003-10-03 18:01:21
|
Mike, As an after thought, I added the following to the top of the script. I don't have a non-NT based machine to make sure that the error is actually displayed correctly however :-/ Cheers, Leif @echo off setlocal if "%OS%"=="Windows_NT" goto nt echo This script only works with NT-based versions of Windows. goto :eof :nt rem ... |