-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist-processes.sh
More file actions
executable file
·50 lines (43 loc) · 1.18 KB
/
list-processes.sh
File metadata and controls
executable file
·50 lines (43 loc) · 1.18 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
43
44
45
46
47
48
49
50
#!/bin/bash
# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
PID_FILE="./running_processes.txt"
if [ ! -f "$PID_FILE" ]; then
echo -e "${RED}No running processes file found.${NC}"
echo "Either no processes were started with start-multiple.sh, or the PID file was deleted."
exit 1
fi
echo -e "${GREEN}Temporal Rate Limit Tester - Running Processes${NC}"
echo ""
workers=0
starters=0
queriers=0
running=0
stopped=0
while IFS=: read -r type pid; do
if kill -0 "$pid" 2>/dev/null; then
status="${GREEN}RUNNING${NC}"
running=$((running + 1))
case $type in
worker) workers=$((workers + 1));;
starter) starters=$((starters + 1));;
querier) queriers=$((queriers + 1));;
esac
else
status="${RED}STOPPED${NC}"
stopped=$((stopped + 1))
fi
echo -e " $type (PID: $pid) - $status"
done < "$PID_FILE"
echo ""
echo -e "${BLUE}Summary:${NC}"
echo " - Workers running: $workers"
echo " - Starters running: $starters"
echo " - Queriers running: $queriers"
echo ""
echo " - Total running: $running"
echo " - Total stopped: $stopped"