save code
This commit is contained in:
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user