Skip to content

Instantly share code, notes, and snippets.

@knikolla
Last active March 23, 2018 19:52
Show Gist options
  • Save knikolla/a921573ded94538796ee5ce1383eb1fb to your computer and use it in GitHub Desktop.
Save knikolla/a921573ded94538796ee5ce1383eb1fb to your computer and use it in GitHub Desktop.
Rsync the current directory to a remote location and execute tox
#!/usr/bin/env bash
# ENV variables required:
# SSH_DEST: destination directory as would have been specified
# to rsync or scp. ex. fedora@10.0.0.1:~
# Get the name of the target directory
TARGET=$(basename `pwd`)
# Clean up
rm -rf .tox
rm -rf .testrepository
cd ../
# rsync with recursive update flag and run
rsync -ah --exclude-from ~/rsync-exclude.txt $TARGET $SSH_DEST
LOG_FILE="$TARGET_`date +%Y-%m-%d:%H:%M:%S`"
ssh -tt $SSH_DEST "cd ~/$TARGET && tox $@" | tee ../$LOG_FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment