bugfixes
continuous-integration/drone/push Build is passing Details

production
Override-6 2 years ago
parent 17a6e7aa48
commit d251b38291

@ -4,18 +4,23 @@ DIR=$(readlink -e "$(dirname "$0")")
PROD_SERVER_JAR_NAME="server-prod.jar"
NEW_SERVER_JAR_NAME="server-all.jar"
OLD_PID=$(ps -aux | tr -s " " | grep -E "\bjava -jar $PROD_SERVER_JAR_NAME\b" | cut -d " " -f2)
#if $OLD_PID is not empty but isn't a number, something went wrong
if [ "$OLD_PID" ] && ! echo "$OLD_PID" | grep -E -q "^[0-9]+$"; then
echo "error, unable to retrieve old server pid: $OLD_PID" >&2
prod_pid() {
ps -aux | tr -s " " | grep -E "\bjava -jar $PROD_SERVER_JAR_NAME\b" | cut -d " " -f2
}
PROD_PID=$(prod_pid)
#if $PROD_PID is not empty but isn't a number, something went wrong
if [ "$PROD_PID" ] && ! echo "$PROD_PID" | grep -E -q "^[0-9]+$"; then
echo "error, unable to retrieve old server pid: $PROD_PID" >&2
exit 2
fi
if [ "$OLD_PID" ]; then
if [ "$PROD_PID" ]; then
#will cause the old server to gracefully shutdown
echo "shutting down old server version ..."
kill -s SIGQUIT "$OLD_PID"
while ! kill -s 0 "$OLD_PID"; do sleep 1; done #sleep until process ends
kill -s SIGQUIT "$PROD_PID"
while [ ! "$(prod_pid)" ]; do sleep 1; done #sleep until process ends
fi
rm "$DIR/$PROD_SERVER_JAR_NAME"

@ -1 +1 @@
endpoint.url=48485
endpoint.port=48485

@ -7,8 +7,8 @@ import java.util.Properties
object EndpointSetup {
final val EndpointUrl = "endpoint.url"
final val EndpointUrlDefault = s"localhost:48485"
final val EndpointPort = "endpoint.port"
final val EndpointPortDefault = "48485"
def setupEndpoint(config: Properties): Endpoint = {
Main.LOG.debug("Initializing API endpoint...")
@ -19,10 +19,10 @@ object EndpointSetup {
private def createEndpoint(config: Properties): Endpoint = {
val port = config
.getProperty(EndpointUrl, EndpointUrlDefault) match {
.getProperty(EndpointPort, EndpointPortDefault) match {
case s"$port" if port.toIntOption.isDefined => port.toInt
case v =>
throw new InternalBasketServerException(s"$EndpointUrl property value is wrong: $v must be integer")
throw new InternalBasketServerException(s"$EndpointPort property value is wrong: $v must be integer")
}
new Endpoint(port)
}