Skip to content

Instantly share code, notes, and snippets.

@scarolan
Created June 12, 2013 14:25
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scarolan/5765738 to your computer and use it in GitHub Desktop.
Save scarolan/5765738 to your computer and use it in GitHub Desktop.
movein.sh - Nice little "move in" script from O'Reilly's excellent Linux Server Hacks book.
#!/bin/sh
# movein.sh - shamelessly stolen from O'Reilly's excellend "Linux Server Hacks"
# http://oreilly.com/pub/h/72
# Version 0.2 - Added some comments and error checking
if [ -z "$1" ]; then
echo "Usage: `basename $0` hostname"
exit
fi
if [ ! -d ~/.skel ]; then
echo "No ~/.skel directory was found. Please create it and add symlinks (or copies) of any files you want to be included."
exit 1
fi
# Here's the magic, this tars everything in ~/.skel up and pushes it out to the remote machine.
# Be careful to make sure there's nothing in ~/.skel that you don't want on the remote host!
cd ~/.skel
tar zhcf - . | ssh $1 "tar zpvxf -"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment