-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_tmux.sh
More file actions
executable file
·47 lines (33 loc) · 1.32 KB
/
Copy pathstart_tmux.sh
File metadata and controls
executable file
·47 lines (33 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
43
44
45
46
#!/bin/bash
# Path to log files
# INFO_LOG="./Log/2025-01-06-13-28-43.txt"
# ERROR_LOG="./Log/2025-01-06-13-28-43.txt"
LOG_FILE="./Log/firehorn.logs"
SERIAL_INPUT_LOG="./Log/packets.logs"
# Session and window names
SESSION_NAME="log_monitor"
WINDOW_NAME="logs"
# Start a new tmux session
tmux new-session -d -s $SESSION_NAME -n $WINDOW_NAME
# Create bottom pane
tmux split-window -v -t $SESSION_NAME
tmux select-pane -t 0
# Pane 1: Tail INFO_LOG
tmux send-keys -t $SESSION_NAME "tail -f -n 20 $LOG_FILE | sed -n '/\[INFO\]/,/,$/p'" C-m
# Split the window horizontally and run tail on ERROR_LOG in the second pane
tmux split-window -h -t $SESSION_NAME
tmux send-keys -t $SESSION_NAME "tail -f -n 20 $LOG_FILE | sed -n '/\[ERROR\]/,/,$/p'" C-m
# tmux split-window -v -t $SESSION_NAME
# Make the bottom pane span the entire width
# tmux resize-pane -t 2 -y 10 # Adjust height as needed
tmux select-pane -t 2
# Run any command in the bottom pane (or leave it for manual use)
tmux send-keys -t 2 'cd build' C-m
tmux split-window -h -t $SESSION_NAME
tmux send-keys -t 3 'cd build' C-m
# Focus back on the top-left pane
tmux select-pane -t 0
tmux split-window -h -t $SESSION_NAME
tmux send-keys -t $SESSION_NAME "tail -f -n 20 $SERIAL_INPUT_LOG | sed -n '/\[INFO\]/,/,$/p'" C-m
# Attach to the tmux session
tmux attach-session -t $SESSION_NAME