Apache prunsrv: error parsing command line - windows

I'm trying to start a Java program as a Windows Service. Googling I've found a install.bat to install and start my service.
As I found on the Internet, I've renamed prunsrv.exe to IdentificationService.exe.
D:\IdentificationService\bin\IdentificationService.exe //IS//IdentificationService
D:\IdentificationService\bin\IdentificationService.exe //US//IdentificationService --Install=D:\IdentificationService\bin\IdentificationService.exe --Description= Identification Service --Jvm="C:\Program Files (x86)\\Diginet\java\bin\server\jvm.dll" --Classpath=D:\IdentificationService\lib --StartMode=jvm --StartClass=br.com..digis.DiginetIdentificationService --StartMethod=start --StartParams=start --StopMode=jvm --StopClass=br.com..digis.DiginetIdentificationService --StopMethod=stop --StopParams=stop --LogPath=D:\IdentificationService\logs --StdOutput=auto --StdError=auto
net start IdentificationService
My problem is that each time I execute IdentificationService it says "Error parsing command line".
I've tried to enclose all parameters by double quotes. Same results.
I've tried to use the original prunsrv.exe withou renaming it. Same results.
What am I missing?

Try setting the parameters through the environment variables
set SERVICE_NAME=CsvToXmlService
set PR_INSTALL=%cd%\prunsrv.exe
set PR_DESCRIPTION=CsvToXml Service
REM Service log configuration
set PR_LOGPREFIX=%SERVICE_NAME%
set PR_LOGPATH=%cd%
set PR_STDOUTPUT=%cd%\stdout.txt
set PR_STDERROR=%cd%\stderr.txt
set PR_LOGLEVEL=Error
REM Path to java installation
set PR_JVM=C:\Program Files\Java\jre7\bin\server\jvm.dll
set PR_CLASSPATH=%cd%\target\app.jar
REM Startup configuration
set PR_STARTUP=auto
set PR_STARTMODE=jvm
set PR_STARTCLASS=ru.misterparser.csvtoxmlservice.Main
set PR_STARTMETHOD=start
REM Shutdown configuration
set PR_STOPMODE=jvm
set PR_STOPCLASS=ru.misterparser.csvtoxmlservice.Main
set PR_STOPMETHOD=stop
REM JVM configuration
set PR_JVMMS=256
set PR_JVMMX=1024
set PR_JVMSS=4000
set PR_JVMOPTIONS=-Duser.language=RU;-Duser.region=ru
REM Install service
prunsrv.exe //IS//%SERVICE_NAME%
sc start %SERVICE_NAME%

rename exe back to prunsrv and run it with exactly same parameters (except first exe ofc)

Related

Does JanusGraph run on Windows 10

Windows 10, janusgraph-0.2.0-hadoop2.
I have put the winutils.exe in the bin folder.
P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\bin>gremlin-server.bat
Error: Could not find or load main class Files
I had a quick look at the bat script and added some echo statements:
echo "%1"
IF "%1" == "-i" (
GOTO install
) else (
GOTO server
)
:: Start the Gremlin Server
:server
IF "%1" == "" (
SET GREMLIN_SERVER_YAML=%JANUSGRAPH_HOME%\conf\gremlin-server\gremlin-server.yaml
) ELSE (
SET GREMLIN_SERVER_YAML=%1
)
java %JAVA_OPTIONS% %JAVA_ARGS% -cp %CP% org.apache.tinkerpop.gremlin.server.GremlinServer %GREMLIN_SERVER_YAML%
echo %JAVA_OPTIONS%
echo %JAVA_ARGS%
echo %CP%
echo %GREMLIN_SERVER_YAML%
echo "call to GremlinServer"
The output:
P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\bin>gremlin-server.bat
.;C:\Program Files (x86)\QuickTime\QTSystem\QTJava.zip;P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\lib\slf4j-log4j12-1.7.12.jar;;P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\lib\janusgraph-all-0.2.0.jar;P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\lib\janusgraph-berkeleyje-0.2.0.jar;P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\lib\janusgraph-bigtable-0.2.0.jar;P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\lib\janusgraph-cassandra-0.2.0.jar;P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\lib\janusgraph-core-0.2.0.jar;P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\lib\janusgraph-cql-0.2.0.jar;P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\lib\janusgraph-es-0.2.0.jar;P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\lib\janusgraph-hadoop-0.2.0.jar;P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\lib\janusgraph-hbase-0.2.0.jar;P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\lib\janusgraph-lucene-0.2.0.jar;P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\lib\janusgraph-solr-0.2.0.jar;P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\lib\*;
""
Error: Could not find or load main class Files
-Xms32m -Xmx512m -Djanusgraph.logdir=P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\log -Dtinkerpop.ext=P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\ext -Dlogback.configurationFile=conf\logback.xml -Dlog4j.configuration=file:/P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\conf\gremlin-server\log4j-server.properties -Dlog4j.debug=true -Dgremlin.log4j.level=WARN -javaagent:P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\lib\jamm-0.3.0.jar -Dgremlin.io.kryoShimService=org.janusgraph.hadoop.serialize.JanusGraphKryoShimService
ECHO is off.
.;C:\Program Files (x86)\QuickTime\QTSystem\QTJava.zip;P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\lib\slf4j-log4j12-1.7.12.jar;;P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\lib\janusgraph-all-0.2.0.jar;P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\lib\janusgraph-berkeleyje-0.2.0.jar;P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\lib\janusgraph-bigtable-0.2.0.jar;P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\lib\janusgraph-cassandra-0.2.0.jar;P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\lib\janusgraph-core-0.2.0.jar;P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\lib\janusgraph-cql-0.2.0.jar;P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\lib\janusgraph-es-0.2.0.jar;P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\lib\janusgraph-hadoop-0.2.0.jar;P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\lib\janusgraph-hbase-0.2.0.jar;P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\lib\janusgraph-lucene-0.2.0.jar;P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\lib\janusgraph-solr-0.2.0.jar;P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\lib\*;
P:\Software\DB\NoSQL\janusgraph-0.2.0-hadoop2\conf\gremlin-server\gremlin-server.yaml
"call to GremlinServer"
This question was also asked on the janusgraph-users Google Group, and I've copied my answers here:
JanusGraph does run on Windows 10. The user experience is not ideal,
and could use some help with people with Windows expertise. I've
opened up issue
950 to track
making the prepackaged distribution more Windows-friendly.
Your problem is probably coming from your CLASSPATH variable, and
I'd think that ".;C:\Program Files (x86)\QuickTime\QTSystem\QTJava.zip;" is messing it up because of the
spaces in the path. Try unsetting the CLASSPATH before running
gremlin-server.bat.
The default Gremlin Server configuration uses
janusgraph-cassandra-es-server.properties because the pre-packaged
distribution bin/janusgraph.sh start will start a single node
Cassandra, a single node Elasticsearch, and the Gremlin Server. If you
want to run with Cassandra, you could go a version directly from the
Apache Cassandra site or a Datastax distribution if you want to go
with an MSI installer. If you're not interested in using Cassandra,
you could change the gremlin-server.yaml to use the
janusgraph-berkeleyje-server.properties which is pretty good for
getting started.

How do I get the specific value from configuration in IIS 8.0 (and above) using appcmd?

I am using IIS 8.5 and I need a getter for a specific property from configuration.
For example, in order to set connectionTimeout property I am using the following syntax :
appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.limits.connectionTimeout:"00:04:00" /commit:apphost
but when I am trying to read the proprety by the following command:
appcmd.exe list config -section:system.applicationHost/sites /siteDefaults.limits.connectionTimeout
I get the following error:
ERROR ( message:The attribute "siteDefaults.limits.connectionTimeout"
is not supported in the current command usage. )
and from what I tried so far it seems that list config command can give me only the section level and not further.
Is there any other way to get a specific property using appcmd?
If Powershell is an acceptable alternative for you, then you can use the WebAdministration Powersell module to get the timeout. Here is a simple script :
#import WebAdministration to access IIS configuration
Import-Module WebAdministration
#declare variables containing your filters
$pspath = "MACHINE/WEBROOT/APPHOST"
$filter = "system.applicationHost/sites/siteDefaults/limits"
$name = "connectionTimeout"
#Read timeout from IIS
$res = Get-WebConfigurationProperty -name $name -filter $filter -pspath $pspath
#Format & write output
Write-Host "Timeout (in seconds): " $res.Value.TotalSeconds -ForegroundColor Yellow
You probably need to run it as admin.
Here is the output:
You can get this using /text:
appcmd.exe list config -section:system.applicationHost/sites /text:siteDefaults.limits.connectionTimeout
if you want to get all possible options for /text: use the following code:
appcmd.exe list config -section:system.applicationHost/sites /text:?

Running Migrations Automatically pre_start in Elixir-Distillery-Release on Windows

i need your help!
im trying to run migrations in a distillery release (Elixir-Application) before the application starts automatically (via Boot Hooks -https://hexdocs.pm/distillery/boot-hooks.html#content).
Development and Production platform must be Windows.
The Problem: I cant find any infos about Windows (.bat)-Scripts referencing the problem - I search for a script for the "pre_start.bat"-File - for calling the ERTS Node and finally my Elixir-Code in it.
my distillery-config : rel\config.exs
environment :prod do
...
set pre_start_hook: "rel/hooks/pre_start"
...
end
The required script should call my code of the "Elixir.MyApp.ReleaseTask.migrate"-Function
How can i achieve this??
The following Code is what ive got so far.. but it doesnt work ..
#echo off
echo Running migrations
echo.
echo.
echo.
cd %RELEASE_ROOT_DIR%
#set system_erl="<erl_directory>\erts-9.1\bin\erl.exe"
#set erl=%system_erl%
#set system_root_dir_cmd=%system_erl% -noshell -eval "io:format(\"~s\", [filename:nativename(code:root_dir())])." -s init stop
#set rootdir=%system_root%
#set system_erts_vsn_cmd=%system_erl% -noshell -eval "Ver=erlang:system_info(version),io:format(\"~s\", [Ver])" -s init stop
#set erts_vsn=%system_erts_vsn%
#set erts_dir=%rootdir%\erts-%erts_vsn%
#set rel_name="my_api"
#set rel_vsn="1.0"
#set consolidated_dir=%rootdir%\lib\%rel_name%-%rel_vsn%\consolidated
#%erl% -boot_var ERTS_LIB_DIR "%erts_dir%\..\lib" ^
-hidden -noshell -boot start_clean ^
-pa "%consolidated_dir%" ^
-s "Elixir.MyApp.ReleaseTasks" "seed" -s init stop
echo Migrations run successfully
Please correct me when im totally wrong with this.
Any help appreciated! BTW its a phoenix-Application.
I would go with erlang’s native escript instead. To build it:
1. update mix.exs, e.g. add:
escript: [main_module: MyApp, path: "bin/migrator"]
to the array returned by MyApp.Mixfile.project/0 function and add bin directory to the release:
# ⇓⇓⇓
files: ~w|bin lib mix.exs README.md|,
to the array returned by MyApp.Mixfile.package/0
2. create MyApp.main/1 function:
def main(_args) do
MyApp.ReleaseTasks.migrate
end
You are all set. There in release will be escript in bin/migrator (the name you used in step 1.)
Now you should be able to run bin/migrator, since it’s a plain old good executable.
Sidenote: mix compile would build this executable as well, so you might play with it and test it before running with distillery.

compiling less to css from classic asp / vbscript

I'm trying to get classic asp / vbscript to run a less compiler (https://github.com/duncansmart/less.js-windows). Running the exact command from a real cmd prompt on the server works fine. So it's going to be one of those permissiony type things. My server is Win2003 x86 / IIS6.
<%
' foo.asp
outpath = "c:\inetpub\wwwroot\site\less"
cmd = "c:\less.js-windows-v1.6.2\lessc.cmd"
Set Shell = server.createobject("WScript.Shell")
nodeCommand = cmd & " " & outPath & "\app.less " & outPath & "\app.css"
errCode = Shell.Run(nodeCommand, 0, True)
' errcode = 1
%>
foo.asp is running somewhere on the web server, anonymously.
cmd.exe has had iusr_server added so that it has read and execute permission.
c:\less.js-windows-v1.6.2 has had iusr_server added with read/execute as well.
I've granted everyone permission to modify files in side c:\inetpub\wwwroot\site\less to make sure it's not a permission thing.
I have tried modifying my command to include CMD /C ahead of the command file name.
Use the following process:
Stop the server
Change relative paths to full paths for all files
Reconfigure the IUSR to be you
Restart the server

Running IIS Express "silent", ie without HTTP console output?

I'm testing the responsiveness of a web application, and want to isolate any slow areas (database access, javascript, etc) and want to be sure that IIS Express isn't slowing things down by all its console output.
Is there a way of running IIS Express without that output, or even without the console being visible at all?
I've tried the /trace:error option, but it still outputs lines for every request.
the following should do the trick:
Create a VBScript: IIS-Express-silent.vbs
Dim App,Site
Site = "[YOUR SITE NAME]"
If Len(Site) < 1 Then
Site = WScript.Arguments(0)
End If
App = """%PROGRAMFILES%\IIS Express\iisexpress""" & _
" /site:" & Site
If Len(Site) > 0 Then
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run App, 0
Set WshShell = Nothing
End If
If you are running IIS Express only as localhost and you don't (intend to) use SSL then you are ready. Just add [YOUR SITE NAME] from applicationhost.config located in your user profile:
<sites>
<site name="[YOUR SITE NAME]" id="1" serverAutoStart="true">
...
</sites>
If you need elevated privileges you must create a second file in the same directory (VBScripts can't be run this way directly): Run-as-Administrator.bat
#echo off
pushd %~dp0
cscript IIS-Express-silent.vbs [YOUR SITE NAME]
Please leave Site in your VBScript blank then and add the name in your batch file instead.
Right mouse button - "Run as Administrator" - and you're done :-)

Resources