You are here

Setting up hourly backups in Deja Dup

Déjà Dup is an excellent graphical backup solution for the GNOME Desktop environment. However, it is limited by that it does not provide backup frequency higher than a day through its graphical interface. So, we will leverage cron to achieve this for us. Adding a simple cron job with the command "xvfb-run deja-dup --backup --auto" will do the trick. But there no fun in it. So lets do it with some style so that we receive the same visual notification that we get whenever a backup happens.

  1. First we need to keep track of the X server display that we log into. This can be done by creating a temporary file whenever we login which contains the value of the DISPLAY environment variable. For this, we will have to add an autostart script. Running the below command should do that:
    $ echo -e '[Desktop Entry]\nName=Dump Display\nType=Application\nExec=echo $DISPLAY > /tmp/display-`whoami`' > ~/.config/autostart/dump-display.desktop
    
  2. Next add the below cron entry (customize the frequency as you like)
    0 * * * *       DISPLAY_FILE="/tmp/display-`whoami`" ; test -f $DISPLAY_FILE  && XCMD="env DISPLAY=`cat $DISPLAY_FILE`" || XCMD="xvfb-run" ; $XCMD deja-dup --backup --auto 1>/dev/null 2>&1
    
  3. If you do not have xvfb-run command, you can install the xvfb package which provides it:
    $ apt-get install xvfb

However, it should be noted that if you login and logout, the file /tmp/display- is left dangling with old information and so the cron command might fail to run successfully till you again login to your desktop session.

Category: 

Add new comment