//View Tip #576
Similar Tips
» Pipe files to an archive
» Bash function to decompress archives
» Moving large directories
» Comparing local and remote files
» Untar multiple files in a directory


Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
nice ssh username@remoteservername "tar cjf - -C /from/basedir/ dirtocopy" | tar xjvf - -C /to/dir/ ; sleep 120 ; shutdown -P now

Copy the remote directory dirtocopy from the remote server to dir of local machine. Transfer the contents using bzip2 compression. When it's done (even if it fails) wait 120 seconds and power off the machine.

View Comments »


Add your comment

Comments are currently disabled
You might not want to assume success there - a broken pipe could result in the system shutting down with an incomplete copy/backup.  Probably a good idea to replace the ;s with &&
Posted 2009-03-23 13:35:28

Home Latest Browse Top 25 Random Hall Of Fame Contact Submit