Skip to content

Instantly share code, notes, and snippets.

@smichaelsen
Created November 27, 2013 09:16
Show Gist options
  • Select an option

  • Save smichaelsen/7672872 to your computer and use it in GitHub Desktop.

Select an option

Save smichaelsen/7672872 to your computer and use it in GitHub Desktop.
tmux script to start (or re-attach) a backup session. The session launches a custom backup script and Time Machine.
if [ `tmux ls | grep -c backup` -gt 0 ]; then
echo "Session found. Attaching.."
else
echo "Session not found. Creating.."
tmux new-session -s backup -n bilder -d
echo "Building window#1 (bilder)"
tmux split-window -v -t backup:1
tmux send-keys -t backup:1.1 '~/backup_bilder' C-m
tmux send-keys -t backup:1.2 'tmutil startbackup' C-m
fi
tmux attach -t backup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment