23 lines
658 B
Bash
23 lines
658 B
Bash
|
#!/bin/bash
|
||
|
SESSION=main
|
||
|
tmux="tmux -2 -u -f $HOME/tmux.conf"
|
||
|
|
||
|
# if the session is already running, just attach to it.
|
||
|
$tmux has-session -t $SESSION
|
||
|
if [ $? -eq 0 ]; then
|
||
|
echo "Session $SESSION already exists. Attaching."
|
||
|
sleep 1
|
||
|
$tmux -u attach -t $SESSION
|
||
|
exit 0;
|
||
|
fi
|
||
|
|
||
|
# create a new session, named $SESSION, and detach from it
|
||
|
$tmux new-session -d -s $SESSION
|
||
|
$tmux new-window -t $SESSION:1
|
||
|
$tmux split-window -h -t $SESSION:1 'sudo htop'
|
||
|
$tmux split-window -v -t $SESSION:1 'sudo journalctl -f'
|
||
|
$tmux new-window -t $SESSION:2
|
||
|
$tmux new-window -t $SESSION:3
|
||
|
$tmux select-window -t $SESSION:1
|
||
|
$tmux attach -t $SESSION
|