Skip to content

Instantly share code, notes, and snippets.

@radditude
Created April 13, 2018 01:10
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 radditude/c4a7c6f6289a1d9e71f6d502b4c5f8ca to your computer and use it in GitHub Desktop.
Save radditude/c4a7c6f6289a1d9e71f6d502b4c5f8ca to your computer and use it in GitHub Desktop.
Tmux start-up script for multiple server processes
#! /bin/zsh
# $PROJECTDIR is set in .zshrc/bash_profile
FIRSTDIR="$PROJECTDIR/first"
SECONDDIR="$PROJECTDIR/second"
# starts a tmux session using iTerm's tmux mode
# opens a new tab for each service and ensures that the name won't get overridden
# runs the servers/queues/processes for each service
# sends the command but doesn't run it for services I don't need all the time
tmux -CC \
set-option -g allow-rename off \; \
new-session -n "FIRST" \; \
send-keys "cd $FIRSTDIR && start the server" C-m \; \
split-window -h \; \
send-keys "cd $FIRSTDIR && start the queue server" \; \
split-window -v \; \
send-keys "cd $FIRSTDIR && start the helper service" C-m \; \
new-window -n "SECOND" \; \
send-keys "cd $SECONDDIR && start the server" C-m \; \
split-window -h \; \
send-keys "cd $SECONDDIR && start the queue server" C-m \; \
split-window -v \; \
send-keys "cd $SECONDDIR && start webpack/the asset service" \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment