Skip to content

Instantly share code, notes, and snippets.

@windwp
Created March 12, 2021 01:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save windwp/7a24d4c371958cdcf74b885ba14f154f to your computer and use it in GitHub Desktop.
Save windwp/7a24d4c371958cdcf74b885ba14f154f to your computer and use it in GitHub Desktop.
run_tmux.sh
#! /bin/sh
docker-compose up &
sleep 4
echo "running"
panel_1=$(tmux split-window -P -F "#{pane_id}")
tmux send -t ${panel_1} "cd ./pi1/" C-m
tmux send -t ${panel_1} "python3 main.py" C-m
pane_2=$(tmux split-window -P -F "#{pane_id}")
tmux send -t ${pane_2} "cd ./pi2/" C-m
tmux send -t ${pane_2} "python3 main.py" C-m
pane_3=$(tmux split-window -P -F "#{pane_id}")
tmux send -t ${pane_3} "cd ./pi3/" C-m
tmux send -t ${pane_3} "python3 main.py" C-m
handle_ctrl_c() {
tmux kill-pane -t panel_1
tmux kill-pane -t panel_2
tmux kill-pane -t panel_3
}
trap handle_ctrl_c SIGINT
while [ $is_running -eq 1 ] ; do
sleep 0.5
done
echo "Quiting..."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment