본문 바로가기
IT 개발, develop/java

spring boot back-ground run

by newly everyday 2020. 3. 23.

linux 환경에서 
특정 프로그램을 지속적으로 실행되고 있는 상태로 만들기 위해서는 nohup 명령을 사용한다. 

다음은 spring-boot 의 jar 를 실행시키기 위한 실행파일  예시이다 


vi restart.sh

#!/bin/bash 
echo "Stopping process on port : 9091" 
/usr/sbin/fuser -n tcp -k 9091 
echo "Start java -Dspring.profiles.active=release -jar hello-0.0.1-SNAPSHOT.jar" 
sleep 1 
nohup /usr/bin/java -Dspring.profiles.active=release -jar > /dev/null & 

 

/dev/null 로 적은 이유는, 로그는 spring-book 내에서 별도의 log 파일로 떨어지도록 설정해두었기 때문이다. 

 

 

 

댓글