Skip to content

Commit f898cc1

Browse files
committed
rasPi .sh update
1 parent c6c0025 commit f898cc1

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

algo_blog_app.pid

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1166

start.sh

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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."

stop.sh

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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

0 commit comments

Comments
 (0)