0

I have an app that is assembled via sbt and launched like this:

java -jar target/scala-2.10/evcat-assembly-0.0.1.jar

I can stop the process by hitting Ctrl-C, but I don't know whether that initiates a normal shutdown process or not. I'm wondering because in my destroy() method I call (besides DB shutdown etc.) some logging routines, but nothing shows after I hit the keyboard.

So, is there a standard way to shutdown my app securely?

tkroman
  • 4,811
  • 1
  • 26
  • 46
  • This question may be relevant: https://stackoverflow.com/questions/5719159/programmatic-jetty-shutdown which also links to https://stackoverflow.com/questions/4650713/jetty-stopping-programatically-causes-1-threads-could-not-be-stopped – DNA Jul 17 '14 at 20:34

1 Answers1

0

I have same issue, I think you need to use "&", so the job will run on the background. Other than that, you need to write the process (pid) into the file, so you can kill it. what we used is shell script and some codes like this.

 java -jar "$JAR_FILE" $OPTIONS >> "$LOG_FILE" 2>&1 & echo $! > "$PID"
Xiaohe Dong
  • 4,953
  • 6
  • 24
  • 53
  • I definitely can kill the process. What I'm worried is how to do it in a way that would not harm data and would not interfere with the application lifecycle (shutdown, in particular). – tkroman Jul 15 '14 at 08:01