File tree Expand file tree Collapse file tree 3 files changed +39
-0
lines changed Expand file tree Collapse file tree 3 files changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ 1166
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # 실행할 포트 번호
4+ PORT=9000
5+
6+ # JAR 파일 이름
7+ JAR_FILE=" build/libs/blog-1.0.jar"
8+
9+ # 로그 파일 이름
10+ LOG_FILE=" output.log"
11+
12+ # nohup을 사용하여 JAR 파일 실행
13+ echo " Starting application on port $PORT ..."
14+ nohup java -jar -Dserver.port=$PORT $JAR_FILE > $LOG_FILE 2>&1 &
15+
16+ # 실행된 프로세스 ID를 PID 파일에 저장
17+ echo $! > algo_blog_app.pid
18+
19+ echo " Application started with PID $( cat algo_blog_app.pid) . Logs are being written to $LOG_FILE ."
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # PID 파일 이름
4+ PID_FILE=" algo_blog_app.pid"
5+
6+ # PID 파일이 존재하는지 확인
7+ if [ -f $PID_FILE ]; then
8+ # PID를 가져와서 해당 프로세스를 종료
9+ PID=$( cat $PID_FILE )
10+ echo " Stopping application with PID $PID ..."
11+ kill $PID
12+
13+ # PID 파일 삭제
14+ rm $PID_FILE
15+
16+ echo " Application stopped."
17+ else
18+ echo " No running application found."
19+ fi
You can’t perform that action at this time.
0 commit comments