-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·45 lines (32 loc) · 897 Bytes
/
start.sh
File metadata and controls
executable file
·45 lines (32 loc) · 897 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
BASE_DIR="$(cd "$(dirname "$0")" && pwd)" || exit 1
umask 002
JAR="$BASE_DIR/examples/nemlogin-signing-webapp/target/nemlogin-signing-webapp-2.0.2.jar"
LOG="$BASE_DIR/logs/java.log"
mkdir -p "$BASE_DIR/logs"
echo "Stopping existing Java process..."
PIDS=$(pgrep -f "$JAR")
if [ -n "$PIDS" ]; then
echo "Found running process(es): $PIDS"
kill $PIDS
# Vent op til 5 sek på shutdown
for i in {1..5}; do
sleep 1
if ! pgrep -f "$JAR" > /dev/null; then
break
fi
done
# Hvis den stadig kører → hard kill
if pgrep -f "$JAR" > /dev/null; then
echo "Force killing..."
pkill -9 -f "$JAR"
fi
else
echo "No running process found"
fi
echo "Starting Java app..."
nohup java -jar "$JAR" > "$LOG" 2>&1 &
sleep 1
NEW_PID=$(pgrep -f "$JAR")
echo "Started with PID: $NEW_PID"
echo "Logging to: $LOG"