Skip to content

Instantly share code, notes, and snippets.

@ianklatzco
Created October 21, 2016 18:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ianklatzco/2da9de2b856156852d50336e06b5b32b to your computer and use it in GitHub Desktop.
Save ianklatzco/2da9de2b856156852d50336e06b5b32b to your computer and use it in GitHub Desktop.
automatically scp/run potd checkout script to ews
#!/bin/bash
# ian klatzco 6 september 2016, some modifcation thru the semester
# WARNING
# make sure you don't have more than the most recent checkout-potd-q*.py file in the directory you set up this script to run in, or else you're gonna have a bad time (multiple downloads of files you've already download, and i am not sure what's gonna happen to your old code)
# WILL WIPE ALL OLD POTD DOWNLOAD SCRIPTS
# ASSUMES
# daily potd download script is dl'd to ~/Downloads
# you store your potds in ~/cs225/potd on your ews account
NETID="NETID GOES HERE"
# USAGE
# first time:
# create ~/cs225/potd on remote
# set your NETID above
# chmod +x potd.sh
# then:
# download daily potd checkout script.py
# ./potd.sh
# bonus: vim ~/.vimrc (locally) and add "alias potd="~/potd.sh"" or wherever you wanan keep potd.sh
# TODO
# only scp the most recently timestamped potd in local
# cd directly into the current potd's folder
# feel free to improve/send me a pull request for any of these
scp ~/Downloads/checkout-potd-q*.py $NETID@linux.ews.illinois.edu:~/cs225/potd # if this doesn't work, set $NETID to your actual netid
rm ~/Downloads/checkout-potd-q*.py # WILL DELETE ALL POTD DOWNLOAD SCRIPTS
ssh $NETID@linux.ews.illinois.edu "cd ~/cs225/potd ; python checkout-potd-q*.py && rm checkout-potd-q*.py"
ssh -t $NETID@linux.ews.illinois.edu 'cd ~/cs225/potd ; exec bash'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment