Very Helpful
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.
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.
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
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.
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
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'
Changing the grep -q fixed this issue. Thanks!