Add start and stop launcher scripts
This commit is contained in:
26
stop.sh
Executable file
26
stop.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PID_FILE="$ROOT_DIR/.doclink-web.pid"
|
||||
|
||||
if [[ ! -f "$PID_FILE" ]]; then
|
||||
echo "No pid file found. If the server is running in another terminal, stop it with Ctrl+C."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
PID="$(cat "$PID_FILE" 2>/dev/null || true)"
|
||||
if [[ -z "${PID:-}" ]]; then
|
||||
rm -f "$PID_FILE"
|
||||
echo "Pid file was empty. Removed it."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if kill -0 "$PID" 2>/dev/null; then
|
||||
kill "$PID"
|
||||
echo "Stopped DocLink Web process $PID"
|
||||
else
|
||||
echo "Process $PID is not running anymore."
|
||||
fi
|
||||
|
||||
rm -f "$PID_FILE"
|
||||
Reference in New Issue
Block a user