-
Notifications
You must be signed in to change notification settings - Fork 0
/
view_logs.sh
executable file
·41 lines (35 loc) · 1.13 KB
/
view_logs.sh
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
#!/bin/bash
# Install btop process monitoring
if ! command -v btop &>/dev/null; then
sudo apt-get install btop -y
fi
# Bool for validator
hasValidator=false
# Check for presense of validator
if systemctl is-active --quiet validator && systemctl is-enabled --quiet validator; then
hasValidator=true
fi
# Kill prior session
tmux kill-session -t logs
# Create panes for validator node or non-staking node
if [ $hasValidator = false ]; then
tmux new-session -d -s logs \; \
send-keys 'journalctl -fu consensus | ccze' C-m \; \
split-window -v \; \
split-window -h \; \
send-keys 'btop --utf-force' C-m \; \
select-pane -t 1 \; \
send-keys 'journalctl -fu execution | ccze' C-m \;
else
tmux new-session -d -s logs \; \
send-keys 'journalctl -fu consensus | ccze' C-m \; \
split-window -h \; \
send-keys 'btop --utf-force' C-m \; \
split-window -v \; \
send-keys 'journalctl -fu validator | ccze' C-m \; \
select-pane -t 0 \; \
split-window -v \; \
send-keys 'journalctl -fu execution | ccze' C-m \;
fi
# Attach to the tmux session
tmux attach-session -t logs