Languages
[Edit]
EN

Bash - start / stop server script for Spring Boot Application

12 points
Created by:
LionRanger
461

In this short article we would like to show how to write simple Bash script that runs own Spring Boot Application server under Linux.

That script lets user to run Spring Boot Application and close terminal safely - application will be working still.

Quick solution:

start-server.sh file:

stop-server.sh file: 

Note: above solution doesn't deal with possible errors, read next section to see better solution.

 

Improved start / stop server scripts

Edit

The reasone why I have created this section in the article was to present some easy way to write start and stop server scripts with better messages on errors with prevention for some unexpected cases (pid file corrupted, port bussy etc.).

Scripts configuration steps:

  1. create in some directory 3 *.sh scrip files that were listed below
  2. indicate path to your applciation in server-config.sh,
  3. set permissions to execute scripts:

Server start / stop operations can be done with:

Script files

Edit

server-config.sh file:

Note: change file extension in APPLICATION_PATH from *.jar to *.war if it is necessary.

start-server.sh file:

stop-server.sh file:

1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Bash

Bash - start / stop server script for Spring Boot Application
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join