#!/bin/sh
# creates the environment for the project a

tmux start-server

if ! $(tmux has-session -t ProjectA)
then

cd /srv/www/ProjectA
tmux new-session -d -s ProjectA -n terminal

tmux new-window -t ProjectA:1 -n editor
tmux set-window-option -t ProjectA:1 aggressive-resize on

cd /srv/www/ProjectA/system/usr/share/doc/database
tmux new-window -t ProjectA:2 -n database
tmux split-window -t ProjectA:2
tmux resize-pane -D -t ProjectA:2.0 20
tmux select-pane -t ProjectA:2.0

tmux new-window -t ProjectA:3 -n log
tmux split-window -t ProjectA:3

cd /srv/www/ProjectA/system/usr/share/doc/test
tmux new-window -t ProjectA:4 -n test

tmux send-keys -t ProjectA:1 ‘vim’ C-m
tmux send-keys -t ProjectA:2.0 ‘mysql -u root -pmypass ProjectA’ C-m
tmux send-keys -t ProjectA:3.0 ‘tail -f /srv/www/ProjectA/system/var/log/messages.log’ C-m
tmux send-keys -t ProjectA:3.1 ‘tail -f /var/log/httpd/error_log’ C-m

tmux select-window -t ProjectA:0

fi

tmux -2 attach-session -t ProjectA

Annunci