Updating ownCloud con rsync

Update
Updating means updating ownCloud to the latest point release, e.g. ownCloud 4.0.6 → 4.0.7. To update an ownCloud installation manually, follow those steps:
If you have installed ownCloud from a repository, your package management should take care of it.

  1. Make a backup.
  2. Unpack the release tarball in the owncloud directory, i.e. copy all new files into the ownCloud installation.
  3. Make sure that the file permissions are correct.
  4. After the next page request the update procedures will run.

Assuming your ownCloud installation is at ./owncloud/ and you want to update to the latest version, you could do the following:
Use rsync in archive mode (this leaves file owner, permissions, and time stamps untouched) to recursively copy all content from ./owncloud/ to a backup directory which contains the current date:

[bash]rsync -a owncloud/ owncloud_bkpdate +"%Y%m%d"/[/bash]

Download the latest version to the working directory:
[bash]wget http://download.owncloud.org/community/owncloud-latest.tar.bz2[/bash]

Extract content of archive to ./owncloud_latest/:
[bash]mkdir owncloud_latest[/bash]

[bash]tar -C owncloud_latest -xjf owncloud-latest.tar.bz2[/bash]

Use rsync to recursivly copy extracted files (new) to ownCloud installation (old) using modification times of the new files, but preserving owner and permissions of the old files:
You should not use this [–inplace] option to update files that are being accessed by others (from rysnc man page)

[bash]rsync –inplace -rtv owncloud_latest/owncloud/ owncloud/[/bash]

Clean up:
[bash]rm -rf owncloud-latest.tar.bz2 owncloud_latest/[/bash]