forked from andrew/feedmill-recounter
feat: start/stop/restart dashboard scripts
This commit is contained in:
1 parent
7230e2b3c8
commit
d89c985134
3 files changed
+40
No files matched your search
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# Restart feedmill recounter web UI (stop, wait, start).
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
./stop_dashboard.sh
|
||||
sleep 1
|
||||
./start_dashboard.sh
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
# Start feedmill recounter web UI (port 9050, override with WEB_PORT env).
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
LOG=/tmp/feedmill_web.log
|
||||
|
||||
if pgrep -f "python app.py" > /dev/null; then
|
||||
echo "Already running (pid $(pgrep -f 'python app.py' | tr '\n' ' ')). Use restart_dashboard.sh to restart."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
nohup python app.py > "$LOG" 2>&1 &
|
||||
sleep 1
|
||||
echo "Started. PID $(pgrep -f 'python app.py'). Log: $LOG"
|
||||
echo "Open http://localhost:${WEB_PORT:-9050}"
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# Stop feedmill recounter web UI. Waits up to 10s for clean shutdown (job-safe).
|
||||
set -euo pipefail
|
||||
if ! pgrep -f "python app.py" > /dev/null; then
|
||||
echo "Not running."
|
||||
exit 0
|
||||
fi
|
||||
pkill -f "python app.py"
|
||||
for _ in $(seq 1 20); do
|
||||
pgrep -f "python app.py" > /dev/null || break
|
||||
sleep 0.5
|
||||
done
|
||||
if pgrep -f "python app.py" > /dev/null; then
|
||||
echo "Still running after 10s — forcing."
|
||||
pkill -9 -f "python app.py"
|
||||
else
|
||||
echo "Stopped."
|
||||
fi
|
||||
Reference in new issue
Block a user