#!/bin/bash set -e echo "[*] Starting wgBill Local Native Environment..." SESSION="wgbill" SESSIONEXISTS=$(tmux list-sessions 2>/dev/null | grep $SESSION || true) # Only create tmux session if it doesn't exist if [ "$SESSIONEXISTS" = "" ] then echo "[.] Starting new tmux session..." tmux new-session -d -s $SESSION sleep 3 # Backend (native) tmux new-window -t $SESSION -n 'backend' tmux send-keys -t "$SESSION:backend" 'cd ./backend && source .venv/bin/activate && python run.py' C-m sleep 5 # Frontend (native) tmux new-window -t $SESSION -n 'frontend' tmux send-keys -t "$SESSION:frontend" 'cd ./frontend && npm run dev' C-m tmux select-layout -t $SESSION tiled else echo "[i] Found existing session." sleep 1 fi echo "Attaching to tmux session..." sleep 1 tmux attach-session -t $SESSION