#!/bin/bash
if [ -f pid.file ]; then
    PID=$(cat pid.file)
    echo "Stopping process $PID..."
    
    # Kill the process group/process smoothly
    kill "$PID" 2>/dev/null
    
    # Clean up the pid file
    rm pid.file
    echo "Stopped successfully."
else
    echo "No running process found (pid.file missing)."
fi
