Java
Spring Boot 앱 systemctl 등록
bboks.net
2018. 4. 13. 10:56
Centos 7 기준 (7 미만에서는 다른 방법으로 등록)
/etc/systemd/system 으로 이동 [앱이름].service 파일 생성 (예. bboks.service)
service 파일 내용
[Unit]
Description=서비스 명
[Service]
User=centos
WorkingDirectory=/home/centos/앱 디렉터리
ExecStart=/usr/bin/java -Djsse.enableSNIExtension=false -Dspring.profiles.active=production -jar /home/centos/앱 디렉터리/앱.jar
SuccessExitStatus=143
TimeoutStopSec=10
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
-Dspring.profiles.active 는 spring profile active를 사용할 경우
-Djsse.enableSNIExtension 는 hand shake 오류가 발생할 경우