B4J Question jShell, kill a long running service

Discussion in 'B4J Questions' started by fransvlaarhoven, Aug 12, 2017 at 5:27 PM.

Similar threads

B4J Library jShell library
B4J Tutorial Print with PrintHtml tool
B4J Question Run jShell in separate thread
B4J Library jShellQueue
B4J Question jShell - passing variables
  1. fransvlaarhoven

    fransvlaarhoven Active Member Licensed User

    Hello,

    I have a question about what happens if one kills a shell:

    - I have a java console application that acts as a server

    - This application starts another application (pgp-keyserver OpenLDAP slapd) using the shell-command with timeout set to -1

    - Before stopping the main java-application, I want to stop the pgp-keyserver OpenLDAP slapd using shell.killprocess

    All that stuff seems to work but I'm not completely satisfied with it: when shell.killproces, is that causing a terminate signal to be sended to the process running in the shell giving that process the chance to close all recources or is it just a plain and simple "kill"?

    For this application is important because not properly stopping slapd might cause problems with the database.

    Many thanks for any information about this subject
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Are you developing with Java or B4J?
     
  3. fransvlaarhoven

    fransvlaarhoven Active Member Licensed User

    I'm developing with B4J :):):)
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    It sends a SIGTERM signal. Though if it is critical for you then you can explicitly call the linux kill command and set the signal.
     
  5. fransvlaarhoven

    fransvlaarhoven Active Member Licensed User

    Thank You for your answer.

    However, the software is running on a windows10 computer...
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    It is a forceful termination on Windows. This means that it will immediately kill the other process.

    The only way to gracefully close it is by calling tasklist.exe to find its PID and then closing it with taskkill.exe.
     
  7. fransvlaarhoven

    fransvlaarhoven Active Member Licensed User

    I was afraid for that. No problem, many ways lead to Rome:)
     
Loading...