Skip to content

Instantly share code, notes, and snippets.

@realchrisolin
Forked from vjt/monitor.sh
Last active December 31, 2015 20:58
Show Gist options
  • Save realchrisolin/8043218 to your computer and use it in GitHub Desktop.
Save realchrisolin/8043218 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Starts a multiplexed terminal session with tmux running monitoring software.
# Requires grc, top, and set_pane (the latter of which is another one of my gists).
# Based off https://gist.github.com/vjt/1893884
#
# tmux 1.7 or later recommended.
#
name=monitor
if ! tmux has-session -t $name; then
#tmux start \; new-session -d -s $name exit \; neww -n monitor 'set_pane bottom "/var/log/syslog" grc tail -f /var/log/syslog' \; splitw -v -p 75 'set_pane bottom "/var/log/auth.log" grc tail -f /var/log/auth.log' \; splitw -v -p 50 \; selectp -t 2 \; splitw -h -p 50 'set_pane bottom "/var/log/kern.log" grc tail -f /var/log/kern.log' \; selectp -t 4
tmux start \; new-session -d -s $name exit \; neww -n monitor 'set_pane bottom "syslog" grc tail -f /var/log/syslog' \; splitw -v -p 75 'set_pane bottom "auth.log" grc tail -f /var/log/auth.log' \; splitw -v -p 50 'top' \; selectp -t 2 \; splitw -h -p 50 'set_pane bottom "kern.log" grc tail -f /var/log/kern.log' \; selectp -t 4
fi
tmux attach -t monitor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment