Publishing static content of a web site

Publish web site composed of static files and directories in directory ~/subdir/ on local machine to web site directory ~/dir/subdir on remote server

$ rsync -thrivpbl ~/mysite/ foouser@host.domain.com:~/dir/msite

or

$ rsync -zhavib ~/mysite/ foouser@host.domain.com:~/dir/mysite

  • -a equals -rlptgoD
    • -r recursive
    • -l preserve links
    • -p preserve permissions
    • -t preserve time stamp
    • If copying on the same computer:
      • -g preserve group
      • -o preserve owner
      • -D or --devices preserve device files
  • -h report human readable numbers
  • -i report itemized list of the changes to each file, including attribute changes.
  • -v verbose
  • -b backup
  • -z compress file data during transfer

Verbose output (-v)

Some common indicators:

  • >f+++++++++: recieving (>) a regular file (f) which is newly created (+).
  • <f.st......: sending (<) a regular file (f) whose size (s) and time stamp (t) are different.
  • >f.st......: recieving (>) a regular file (f) whose size (s) and time stamp (t) are different.
  • .d..t......: not updating (initial .) a directory (d) whose time stamp (t) is different.

References: http://stackoverflow.com/questions/4493525/rsync-what-means-the-f-on-rsync-logs

Safely copying large file

$ sudo rsync -vahzi --progress /Volumes/large_file.mp4 /Volumes/new_file.mp4

Safely copying a large directory

$ sudo rsync -vahzi --progress /Volumes/large_dir/ /Volumes/new_dir

Installing up-to-date rsync via Homebrew on macOS

The version of rsync coming with macOS operating system is an older version (2.* as of OS X 10.10.2). To install the more up-to-date version,

brew doctor
brew upgrade
brew tap homebrew/dupes
brew install rsync

Make sure the path Homebrew installs softwares to, /usr/local/bin appears before other paths in /private/etc/paths so it's searched first. Restart the terminal.

blog comments powered by Disqus