forked from gsalucci/firefox-profiles-to-ram
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck-logs.sh
More file actions
executable file
·74 lines (63 loc) · 1.65 KB
/
check-logs.sh
File metadata and controls
executable file
·74 lines (63 loc) · 1.65 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
# Browser Profile to RAM Utils - Log Viewer
# Quick reference for checking logs
set -euo pipefail
# Colors
readonly BLUE='\033[0;34m'
readonly YELLOW='\033[1;33m'
readonly NC='\033[0m'
usage() {
cat <<'EOF'
Usage: check-logs.sh [OPTION]
OPTIONS:
logs Show browser-to-ram-utils logs (last 50 lines)
live Follow logs in real-time
service Show systemd service logs (start/stop events)
status Show service status
help Show this help message
EXAMPLES:
check-logs.sh logs # View script logs
check-logs.sh live # Watch logs live
check-logs.sh service # View systemd unit logs
check-logs.sh status # Service status
EOF
}
show_logs() {
echo -e "${BLUE}=== Browser to RAM Utils Script Logs ===${NC}"
# -t matches the identifier used by systemd-cat
journalctl --user -t browser-to-ram -n 50 --no-pager
}
show_live() {
echo -e "${BLUE}=== Following Script Logs (Live) ===${NC}"
echo -e "${YELLOW}Press Ctrl+C to stop${NC}"
journalctl --user -f -t browser-to-ram
}
show_service_logs() {
echo -e "${BLUE}=== Systemd Service Unit Logs ===${NC}"
journalctl --user -u browser-to-ram-utils.service -n 50 --no-pager
}
show_status() {
echo -e "${BLUE}=== Service Status ===${NC}"
systemctl --user status browser-to-ram-utils.service
}
case "${1:-logs}" in
logs)
show_logs
;;
live)
show_live
;;
service)
show_service_logs
;;
status)
show_status
;;
help|--help|-h)
usage
;;
*)
usage
exit 1
;;
esac