-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmac_status_v3_product.sh
More file actions
39 lines (33 loc) · 939 Bytes
/
Copy pathmac_status_v3_product.sh
File metadata and controls
39 lines (33 loc) · 939 Bytes
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
#!/bin/zsh
set -euo pipefail
ROOT="${0:A:h}"
PID_DIR="${ROOT}/results/product_runtime"
failed=0
launchd_labels=(
com.zarks.quant.v3-product-dashboard
com.zarks.quant.v3-product-intraday
com.zarks.quant.v3-product-runtime
com.zarks.quant.v3-product-crypto
)
launchd_running=0
for label in "${launchd_labels[@]}"; do
if launchctl print "gui/$(id -u)/${label}" >/dev/null 2>&1; then
print "RUNNING ${label} (launchd)"
launchd_running=$((launchd_running + 1))
else
print "STOPPED ${label} (launchd)"
fi
done
if [[ "${launchd_running}" -eq "${#launchd_labels[@]}" ]]; then
exit 0
fi
for name in product_dashboard v3_intraday_capture v3_g6_runtime crypto_pit_collector; do
pid_file="${PID_DIR}/${name}.pid"
if [[ -f "${pid_file}" ]] && kill -0 "$(<"${pid_file}")" 2>/dev/null; then
print "RUNNING ${name} pid=$(<"${pid_file}")"
else
print "STOPPED ${name}"
failed=1
fi
done
exit "${failed}"