Hi Christian,

see the text below, the previous mail was rejected, probably because I attached some batch files.

I will insert the pretty straightforward content here:

start.bat

cd /D "%~dp0"
set MAVEN_OPTS="-Xmx4096m"
mvn exec:java -Pstart

stop.bat

cd /D "%~dp0"
mvn exec:java -Pstop



-------- Weitergeleitete Nachricht --------
Betreff: Re: [basex-talk] Stopping BaseX HTTP server
Datum: Fri, 2 Aug 2019 11:47:28 +0200
Von: Markus Wittenberg <Wittenberg@axxepta.de>
An: Christian Grün <christian.gruen@gmail.com>
Kopie (CC): BaseX <basex-talk@mailman.uni-konstanz.de>


 Hi Christian,

I've attached the complete pom.xml and the batch files for starting and stopping. Thanks for looking into this.

I forgot to mention in the last mail that I can stop the server by the stop.bat on Windows Server, but only if I call it directly, not via the task scheduler (which works also on my machine). I also adjusted the execution path correctly in the task scheduler, so that shouldn't be the problem. The running server does respond, but only with the repeated message that the HTTP server was started, the stop parameter seems to be gone missing.

And by the way, I'm wondering whether there is another way to stop the server cleanly than by calling the BaseXHTTP class again with the stop parameter?

Best regards,

  Markus

Am 02.08.2019 um 11:00 schrieb Christian Grün:
Hi Markus,

I had a quick look at the snippet of your pom.xml file, but I’d need
some more time to get this running. Could you please provide us with a
little self-contained example? Maybe a single pom.xml could be
sufficient.

Thanks in advance,
Christian

PS: It’s a deliberate design decision indeed that the BaseX HTTP
server cannot be stopped via HTTP requests. Good to hear that your
current approach does already work on your local system.




On Thu, Aug 1, 2019 at 7:20 PM Markus Wittenberg <Wittenberg@axxepta.de> wrote:
Hi all,

we have a problem trying to stop a BaseX HTTP server with the Windows
task scheduler. The server ist started with a maven profile, calling

mvn exec:java -Pstart

pom.xml extract see below, and can also be stopped directly with the
corresponding stop profile by a batch file:

cd /D "%~dp0"
mvn exec:java -Pstop

But calling this batch profile in task scheduler works fine on our local
computers, but does not work on the server (Windows Server 2012). On
this machine, executing the stop profile by the task scheduler results
in a message

HTTP server was started (port: 8985).

in the console window of the process to be stopped, but it continues
running anyway.

Any ideas regarding this strange behavior?

Can we stop the server with a simple HTTP request? Calling
localhost:8985 in the browser also results only in the message above.

Thanks in advance for any hints.

Best regards,

Markus


Extract from pom.xml:


<profile>
<id>start</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<configuration>
<mainClass>org.basex.BaseXHTTP</mainClass>
<arguments>
<argument>-h9894</argument>
<argument>-s8985</argument>
<argument>-p1985</argument>
<argument>-Urestxq</argument>
</arguments>
<additionalClasspathElements>
<additionalClasspathElement>src/main/resources</additionalClasspathElement>
</additionalClasspathElements>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>stop</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<configuration>
<mainClass>org.basex.BaseXHTTP</mainClass>
<arguments>
<argument>-s8985</argument>
<argument>stop</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>


--
Markus Wittenberg

Tel +49 (0)341 248 475 36
Mail wittenberg@axxepta.de

----

axxepta solutions GmbH
Lehmgrubenweg 17, 88131 Lindau

Amtsgericht Berlin HRB 97544B
Geschäftsführer: Karsten Becke, Maximilian Gärber

-- 
Markus Wittenberg

Tel +49 (0)341 248 475 36
Mail wittenberg@axxepta.de

----

axxepta solutions GmbH
Lehmgrubenweg 17, 88131 Lindau

Amtsgericht Berlin HRB 97544B
Geschäftsführer: Karsten Becke, Maximilian Gärber