-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatus_worker.sh
More file actions
42 lines (34 loc) Β· 1.32 KB
/
status_worker.sh
File metadata and controls
42 lines (34 loc) Β· 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
# Check PDF Docling Worker status
PID_FILE="$(pwd)/worker.pid"
LOG_FILE="$(pwd)/worker.log"
echo "π PDF Docling Worker Status"
echo "============================"
if [[ ! -f "$PID_FILE" ]]; then
echo "β No PID file found - Worker not running"
exit 1
fi
WORKER_PID=$(cat "$PID_FILE")
if kill -0 "$WORKER_PID" 2>/dev/null; then
echo "β
Worker is running"
echo "π Process ID: $WORKER_PID"
echo "β° Started: $(ps -o lstart= -p $WORKER_PID 2>/dev/null || echo 'Unknown')"
echo "πΎ Memory: $(ps -o rss= -p $WORKER_PID 2>/dev/null | awk '{print $1/1024 " MB"}' || echo 'Unknown')"
echo "β‘ CPU: $(ps -o %cpu= -p $WORKER_PID 2>/dev/null || echo 'Unknown')%"
if [[ -f "$LOG_FILE" ]]; then
echo ""
echo "π Recent log entries (last 10 lines):"
echo "ββββββββββββββββββββββββββββββββββββ"
tail -10 "$LOG_FILE"
fi
echo ""
echo "π Management commands:"
echo " ./stop_worker.sh # Stop the worker"
echo " tail -f $LOG_FILE # View live logs"
echo " ps -fp $WORKER_PID # Detailed process info"
else
echo "β Worker with PID $WORKER_PID is not running"
echo "π§Ή Cleaning up stale PID file"
rm -f "$PID_FILE"
exit 1
fi