20 lines
360 B
Bash
Executable File
20 lines
360 B
Bash
Executable File
#!/usr/bin/env bash
|
|
cd "$(dirname "$0")"
|
|
|
|
PID_FILE=proxy.pid
|
|
|
|
if [ ! -f "$PID_FILE" ]; then
|
|
echo "not running (no pid file)"
|
|
exit 1
|
|
fi
|
|
|
|
PID=$(cat "$PID_FILE")
|
|
if kill -0 "$PID" 2>/dev/null; then
|
|
kill "$PID"
|
|
rm -f "$PID_FILE"
|
|
echo "stopped (pid $PID)"
|
|
else
|
|
rm -f "$PID_FILE"
|
|
echo "stale pid file removed (process $PID not found)"
|
|
fi
|