mirror of
https://github.com/usatiuk/dhfs.git
synced 2025-10-28 12:37:48 +01:00
27 lines
384 B
Bash
Executable File
27 lines
384 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -e
|
|
set -u
|
|
set -o pipefail
|
|
|
|
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
|
|
|
PIDFILE="$SCRIPT_DIR"/.pid
|
|
|
|
if [ ! -f "$PIDFILE" ]; then
|
|
echo "Not running"
|
|
exit 2
|
|
fi
|
|
|
|
if ! kill -0 $(cat "$PIDFILE") >/dev/null; then
|
|
echo "Not running"
|
|
rm .pid
|
|
exit 2
|
|
fi
|
|
|
|
PID=$(cat "$PIDFILE")
|
|
|
|
echo "Killing $PID"
|
|
kill "$PID"
|
|
|
|
rm .pid
|