Created
March 12, 2021 01:36
-
-
Save windwp/7a24d4c371958cdcf74b885ba14f154f to your computer and use it in GitHub Desktop.
run_tmux.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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