Last active
September 26, 2018 12:48
-
-
Save manigandand/1bc450fda02589c1ad2e9251337e63fd to your computer and use it in GitHub Desktop.
Tmuxinator & Shell script to automate deployment
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 | |
# | |
DEPENDENCY_XDOTOOL=xdotool | |
DEPENDENCY_TMUXINATOR=tmuxinator | |
# Dependencies: | |
if ! type "$DEPENDENCY_XDOTOOL" > /dev/null; then | |
echo "$DEPENDENCY_XDOTOOL not found. installing it..." | |
sudo apt install xdotool | |
fi | |
if ! type "$DEPENDENCY_TMUXINATOR" > /dev/null; then | |
echo "$DEPENDENCY_TMUXINATOR not found. installing it..." | |
sudo apt install tmuxinator | |
fi | |
WID= xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)"| awk '{print $5}'; xdotool windowfocus $WID; | |
# xdotool key ctrl+shift+t $WID | |
TMUX_PANDORA_SESSION_NAME="pandora" | |
if (tmux has-session -t "$TMUX_PANDORA_SESSION_NAME" 2> /dev/null); then | |
echo "Session '$TMUX_PANDORA_SESSION_NAME' exists." | |
else | |
echo "creating a new session "$TMUX_PANDORA_SESSION_NAME | |
tmux new-session -d -s $TMUX_PANDORA_SESSION_NAME | |
# tmux send-keys -t $TMUX_PANDORA_SESSION_NAME "echo 'Now:'; while true; do printf '%(%c)T\r'; done" ENTER | |
tmux send-keys -t $TMUX_PANDORA_SESSION_NAME "xdotool key ctrl+b c" C-m | |
fi | |
# sleep 1; xdotool type --delay 1 --clearmodifiers 'tmux'; xdotool key Return; | |
# sleep 1; xdotool type --delay 1 --clearmodifiers 'echo "Pandora Window Tab 2"'; xdotool key Return; | |
# ==================> | |
# WID= xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)"| awk '{print $5}'; xdotool windowfocus $WID; xdotool key ctrl+shift+t $WID | |
# echo "Pandora Window Tab 1" | |
# sleep 1; xdotool type --delay 1 --clearmodifiers 'echo "Pandora Window Tab 2"'; xdotool key Return; | |
# WID= xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)"| awk '{print $5}'; xdotool windowfocus $WID; xdotool key ctrl+shift+t $WID | |
# sleep 1; xdotool type --delay 1 --clearmodifiers 'echo "Pandora Window Tab 3"'; xdotool key Return; | |
# gnome-terminal --tab --tab | |
# gnome-terminal --tab -e "bash -c \"echo "hello";exec bash\"" |
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
# ~/.tmuxinator/workspace_backend.yml | |
project_name: workspace_backend | |
project_root: ~/ | |
windows: | |
- batman-rpc-worker: | |
layout: tiled | |
panes: | |
- rdckr # run nsq, nsqlookupd, nsqadmin docker images #<%= @args[0] %> | |
- aircto && ./batman_rpc | |
- aircto && wrkr | |
- batman-api: | |
layout: main-vertical | |
panes: | |
- aircto && server # run batman backend server | |
- aircto #empty, will just run plain bash | |
- DB: | |
- sudo -u postgres psql candidate_discovery_staging | |
- staging-ssh: | |
- #empty, will just run plain bash | |
- production-ssh: | |
- #empty, will just run plain bash | |
- empty: | |
- #empty, will just run plain bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment