```shell #!/bin/bash pids=$(pgrep -f "community_demo-0.0.1-SNAPSHOT.jar") if [ -n "$pids" ]; then echo "[INFO] Stopping old community_demo process(es): $pids" kill -15 $pids sleep 2 pids_again=$(pgrep -f "community_demo-0.0.1-SNAPSHOT.jar") if [ -n "$pids_again" ]; then echo "[WARN] Force killing process(es): $pids_again" kill -9 $pids_again fi fi SCRIPTDIR="$( cd "$( dirname "$0" )" && pwd )" echo "[INFO] Script directory: $SCRIPTDIR" echo "[INFO] Starting new community_demo process..." nohup java -jar /opt/community/community_demo-0.0.1-SNAPSHOT.jar >> /opt/community/logs/nohup.log 2>&1 & echo "[INFO] Process started with PID: $!" tail -f /opt/community/logs/nohup.log ```