-
Notifications
You must be signed in to change notification settings - Fork 41.4k
Closed
Milestone
Description
We're now using the launch script that is being created by spring boot to manage the start/stop of our services (integrated with AWS Code Deploy). But sometimes, we're getting some deployment failures because the application didn't stop and the tomcat port is still in use.
Looking at the script, I think that the rm -f "$pid_file"
in the stop
method isn't correct because the PID file is being deleted before stopping the application.
Although, the do_stop
method looks fine because it's triggering the shutdown and waiting until the application is stopped to delete the PID file, so the fix for this issue will just delete the additional line in the stop
method.
Or am I missing something?
stop() {
[[ -f $pid_file ]] || { echoYellow "Not running (pidfile not found)"; return 0; }
pid=$(cat "$pid_file")
rm -f "$pid_file"
isRunning $pid || { echoYellow "Not running (process ${pid} not found)"; return 0; }
do_stop $pid $pid_file
}
do_stop() {
kill -HUP $1 &> /dev/null || { echoRed "Unable to kill process $1"; return 1; }
for i in $(seq 1 60); do
isRunning $1 || { echoGreen "Stopped [$1]"; rm -f $2; return 0; }
sleep 1
done
echoRed "Unable to kill process $1";
return 1;
}
Metadata
Metadata
Assignees
Labels
No labels