วันพุธ, มีนาคม 02, 2554

Calibre server; howto sync repository between local & remote server


  1. Install calibre in desktop pc, building my ebooks library
  2. Move default Calibre's repository to another place i.e.: calibre-repo
  3. Add the books as much as you want.
  4. Copy folder calibre-repo to the a remote server
  5. Use rsync program to synchronize the repository between a desktop (which always add a new book from here) and the remote server

    Command line

    To sync/copy the refresh repository data to the remote 

    rsync -r -a -v -e "ssh -l " :/remote/path /local/path

  6. On remote server I'm starting calibre server with this command
    calibre-server --daemonize --auto-reload --pidfile=$HOME/calibre.pid --port=8012 --with-library=$HOME/calibre-repos
    headless start, background process no need the GUI environment.
  7. After first deployment, whenever I want to update the remote's repository I will execute the command in #5
  8. For sure, I will restart the calibre process;(#6)
  9. To restart the calibre process use
     kill -9 `cat HOME/calibre.pid`
    then execute the command in #6 again


Reference: 


$rsync -r -a -v -e "ssh -l " --delete :/remote/path /local/path

from: http://www.cyberciti.biz/tips/linux-use-rsync-transfer-mirror-files-directories.html


$rsync -avz --stats  /tmp/dir1/ /tmp/dir2

from: http://www.unixtutorial.org/2008/09/how-to-synchronize-directories-with-rsync/