spring-boot-initscript icon indicating copy to clipboard operation
spring-boot-initscript copied to clipboard

Very Helpful

Open kibbled opened this issue 11 years ago • 6 comments

Thanks for this template it was very helpful. One thing I have noticed with this script is that when I start my service: "sudo service my-spring-boot start" is that the cursor is not released so I have to hit CTRL-C. This is on Amazon's Linux (RHEL), any ideas?

Also for some reason the script has a hard time resolving the $JAVA_HOME, even root and the current user has it set (probably an environment issue). I just worked around this one by modifying the script.

kibbled avatar Feb 02 '15 15:02 kibbled

I don't see why the cursor would be captured. Try and put a few echos into the script to see how far its coming and whether it stops somewhere.

rburgst avatar Feb 03 '15 08:02 rburgst

I have the same issue as kibbled, its stuck in this loop on "start"

while { pid_of_spring_boot > /dev/null ; } && ! { tail --lines=+$cnt "$LOG" | grep -q ' Started \S+ in' ; } ; do sleep 1 done

mherb63 avatar Feb 18 '15 14:02 mherb63

please check what the output of your server is when it boots up. The goal here is to find a line that says something like "Started XXX in Ys". Aparently your log levels are different which prevents this message from showing up. You might need to adapt your log levels or grep for some other log line to figure out whether the server has finished booting.

rburgst avatar Feb 19 '15 19:02 rburgst

Sorry, I'm not much of a bash scripter. But, here's the line I think you're grepping for:

2015-02-19 13:18:29.692 INFO 4044 --- [main] com.xxx.yyy.Application : Started Application in 18.421 seconds (JVM running for 19.248)

I am using Spring Boot default logging, in my application.properties file I'm setting: logging.file:logs/myapp.log

mherb63 avatar Feb 19 '15 20:02 mherb63

the script expects the log file to go to

 LOG="/var/log/$PROJECT_NAME/$PROJECT_NAME.log"

If you configure the app to some other log file, then you need to change this value. If that alone is not enough you can relax the REGEXP to do

grep -q ' Started Application in .* seconds' 

rburgst avatar Feb 19 '15 20:02 rburgst

Changing the grep -q fixed this issue. Thanks!

mherb63 avatar Feb 19 '15 20:02 mherb63