Getting mails via IMAP with mbsync

mbsync is a command line application which synchronizes mailboxes; currently Maildir and IMAP4 mailboxes are supported …

We can use it to make a copy/backup/mirror from own mail accounts following the new

  1. First, enable IMAP in your mail account.
  2. Install the dependencies for mbsync:

    sudo apt-get install libc6 libdb4.2 libssl0.9.8 isync

    (maybe, you must consider the original post)

    Now you should have an executable mbsync in your path. So it is time to start preparing to do the initial sync.

  3. Choose a place to store your backups. For example: /mnt/sdh1/backups
  4. To access securely, we’ll need the latest SSL certificates. To get those, we can
    use the openssl client. For GMail case:

    openssl s_client -connect -showcerts

    which should show two blocks of



    in the output. You’ll want to take each block (including the BEGIN/END CERTIFICATE lines), and put each of them into their own file. I put the first one in a file gmail.crt and the second one in the file google.crt (since the first signs which is signed by Google Internet Authority, the second certificate).

  5. The second certificate, the one for the Google Internet Authority, is signed by Equifax. So we’ll need Equifax’s certificate also. An as it turns out, Ubuntu has a copy of Equifax’s certificate already sitting in the repositories. Just run

    sudo apt-get install ca-certificates

    to get the latest CA certificates. After installing the CAs, Equifax’s CA sits at /usr/share/ca-certificates/mozilla/Equifax_Secure_CA.crt, which we’ll need in the configuration file in the next step.

  6. Now we can write the configuration file we are going to use. Here is a copy of mine:

    IMAPAccount gmail
    UseIMAPS yes
    CertificateFile /mnt/sdh1/certs/mail/gmail.crt
    CertificateFile /mnt/sdh1/certs/mail/google.crt
    CertificateFile /usr/share/ca-certificates/mozilla/Equifax_Secure_CA.crt

    IMAPStore gmail-remote
    Account gmail

    MaildirStore gmail-local
    Path /mnt/sdh1/backups/mail/gmail/
    Inbox /mnt/sdh1/backups/mail/gmail/Inbox

    Channel gmail
    Master :gmail-remote:
    Slave :gmail-local:
    # Exclude everything under the internal [Gmail] folder, except the interesting folders
    # Patterns * ![Gmail]* “[Gmail]/Sent Mail” “[Gmail]/Starred” “[Gmail]/All Mail”
    Patterns *
    Create Slave
    Sync Pull
    SyncState *

    Check out the Patterns line. That is where you would include or exclude various labels. All lables are stored at the root of the hierarchy, with the special directory [Gmail] having things like ‘Sent Mail’, ‘Spam’, ‘Starred’, etc in it. I wanted to exclude all the items in the [Gmail] directory except for the ones listed. The ‘*’ at the beginning includes all other labels. You will also want to change the Path and Inbox lines to point to your mail location, as well as the first two CertificateFile lines. Also, be sure to enter your actual GMail login on the User line. Now save this file somewhere. Note: saving it as ~/.mbsyncrc will cause it to be automatically loaded when mbsync is run, meaning you don’t need to specify which config file with the -c option.

  7. Now go ahead and test it out by listing the labels in your account with the command mbsync -l -c /path/to/the/configfile.rc gmail. Running it will look like this and ask you for your password:

    [streeter@scout]:~$ mbsync -l -c ~/.mbsyncrc gmail
    Reading configuration file /home/streeter/.mbsyncrc
    Resolving… ok
    Connecting to… ok
    Connection is now encrypted
    Logging in…
    Password (
    Channel gmail
    [Gmail]/Sent Mail
    [Gmail]/All Mail

    If you see something like this, then it worked! Now just go ahead and start your

  8. Finally, try to download all the scanned labels:

    mbsync -c ~/.mbsyncrc gmail

That’s is all!.

Working with

One of my pending aims is try to work with git (SCM). Normally, when I am developing , I work with SVN or BZR. From some time ago, I use git only as a way to get source tarballs and nothing else, but now, I think that can try to use git in some minor project to obtain a real experience opinion.
In next lines, I am going to write some little notes about use of git into
I think that this notes are useful for me, primarly, but can be useful for other git-beginners, too.

Global setup:

Download and install Git
git config –global “Pablo Saavedra”
git config –global
Add your public key at

Next steps, creating a new repository:

mkdir awstats-update
cd awstats-update
git init
touch README
git add README
git commit -m ‘first commit’
git remote add origin
git push origin master

Other way, existing Git Repo:

cd existing_git_repo
git remote add origin
git push origin master

The last way, importing from Subversion:

git-svn can be used to import as well. Note that there may be issues if you have branches or tags (they won’t be imported over). If you only have a trunk, like many svn repositories, this method should work for you without issue.
First, be sure to create your repository on GitHub
$ git svn clone -s SVN_REPO_URL LOCAL_DIR
$ git remote add origin
$ git push origin master
Note that the -s switch implies that your svn repo is set up with the standard branches/tags/trunk structure.
git-svn adds a note to every commit message it copies over from svn. To get rid of that note, add –no-metadata to the command.
You can pull in later commits by running git-svn rebase from within your repo. If you ever lose your local copy, just run the import again with the same settings and you’ll get another working directory with all the necessary git-svn settings saved.



Finally, I have achieved to push my first git repository at This repo is a set  formed by silly (but usefull) tools: awstats-update.

Basically, this tools are a couple de scripts which can be executed as cronjobs. These, periodically, are checking  if exist new sites enabled in the apache/nginx configuration and building the corresponding awstats configuration file for them.

The repository can be accessed from:


Red5: The OpenSource RTMP server

Recently, I started to work with Red5 RTMP server. Red5 is a OpenSourceRTMP server based on Spring/Tomcat/Java technologies and this is the alternative to the privative Adobe FMS (Flash Media Server) .

Currently, Red5 project has reachend the 0.9 milestone of the Red5 roadmap. You can the latest feautures added to Red5 in:  Here’s a brief description of the features in Red5:

  • Streaming Audio/Video (FLV and MP3)
  • Recording Client Streams (FLV only)
  • Shared Objects
  • Live Stream Publishing (live h264 supported now)
  • Remoting ( AMF0/ AMF3)

You also need to know 2 concepts:

  • Red5 is a Java aplication server framework that provide all the logic for FLV reflection.
  • You will deploy aplications over Tomcat or stanalone Red5 launcher. This aplication will use the red5 jar library for implement the application logic.

Red5 community work primarly with Java progaming language. In anyway, you can work with another supported language to deploy the application and hadlers. For example: jython, jruby or action script. You can obtain more info in and