#!/bin/bash
# Create tmux session with 3 panes showing various status information for mosh-client to connect to
# Invoke this on the remote machine with:
#
# $ mosh root@server.example.com -- /root/bin/setup_dashboard.sh
#
# and if you get disconnected, the mosh command:
#
# $ mosh root@server.example.com -- tmux attach
# tmux list-windows gives you this layout string, which is used to reset the panes
LAYOUT="1cc2,157x66,0,0[157x26,0,0,0,157x39,0,27{79x39,0,27,1,77x39,80,27,2}]"
# quoting shell commands with tmux can be an issue, so we don't use shell variables
/usr/local/bin/tmux new-session -d -s sysop -n dash '/usr/bin/less -WX +F /storage/www/server.example.com/application/log/development.log'
/usr/local/bin/tmux split-window -t dash /usr/bin/dstat
/usr/local/bin/tmux split-window -t dash -h /usr/bin/top
/usr/local/bin/tmux select-layout -t dash $LAYOUT
/usr/local/bin/tmux attach-session -t sysop