22

Is there a way I get the amazing Deja-dup to make me hourly backups in addition to daily, weekly, biweekly etc? If not, is there something else that I could use instead?

jrg
  • 60,611
  • I had tried " Back in Time" couple days ago - it looks pretty good for me. It has an option to setup a schedule (hourly, daily, weekly, e.t.c.). I don't know if it could fully cover your needs, but you can find more detailed info in this post : http://askubuntu.com/questions/2596/comparison-of-backup-tools – Justas Aug 01 '11 at 10:36
  • None of the above works with current deja-dup versions. As the cronjob seems to be unable to read to dconf settings correctly. is always backing up to local default settings. Be-aware: it seems ok. but it is not. With the solutions above you DO NOT HAVE A BACKUP! It stores the files in your home-directory again (like defined in the default settings)! –  Nov 02 '12 at 15:56
  • @PhilipWeber yes, the default backup settings are rather... not cool. – jrg Nov 02 '12 at 16:56

4 Answers4

15

Install Scheduled Tasks:

enter image description here

Add a job to it with the following parameters (replace every minute with every hour or the schedule you want to use):

enter image description here

You can even hide the pop-up window by using deja-dup --backup --auto as the command or use X-Application: suppress outup in the default behavior drop box, it will hide the window while deja-dup runs.

Bruno Pereira
  • 73,643
  • 2
    Nice solution - uses GUI. Good for the terminal-shy. – fixedit Oct 16 '11 at 00:10
  • 1
    As we discussed in the chatroom, this doesn't seem to work either. – jrg Oct 16 '11 at 23:55
  • Care to follow the comment I made on the question? Its just the output of deja-dup --backup when you run it by hand. That will help troubleshooting or maybe writing a script for duplicity that does the same as deja-dup. This works perfect in my case. – Bruno Pereira Oct 17 '11 at 05:37
  • Its a bug/problem with the USB drives, not a problem of the solutions, both this and George's work. Have a look here. – Bruno Pereira Oct 17 '11 at 08:31
  • The final recommendation was to remove deja-dup sudo apt-get purge deja-dup and reinstall :S Sorry man, really hope this will solve it for you cause after that the only option is to issue a bug report! – Bruno Pereira Oct 17 '11 at 08:38
  • 2
    Just a note that you can add --auto to the command line to get a hidden window from the start. That's how deja-dup kicks off its own scheduled backups. – Michael Terry Oct 18 '11 at 04:01
  • 1
    @MichaelTerry thx man, will include this on the answer if its ok – Bruno Pereira Oct 21 '11 at 18:03
  • @brunopereira81 Your answer works for those of us who don't have USB drives formatted in funky ways, your solution is user friendly and it works. (I don't need the script, found a way to do it with symlinks to trick deja-dup into thinking it's not a USB drive) – jrg Oct 21 '11 at 18:06
  • @jrg good to know, the script will just try to replace deja-dup on the most perfect way possible while not having these stupid checkpoints :( If its ever ready I'll post it here since its the same thing as running deja-dup under normal conditions ;) – Bruno Pereira Oct 21 '11 at 18:12
  • Ok, awesome. :) – jrg Oct 21 '11 at 18:49
  • Doesnt work with --auto works just deja-dup --backup – Kangarooo Oct 24 '12 at 01:34
  • BTW i cant hide output anyway. – Kangarooo Oct 24 '12 at 02:47
14

Although it seems like the Déjà Dup code could not be easily modified to accomodate an hourly option, backups can be manually initiated and this can easily be added as a cron job that runs on the hour.

Here are the steps you need to take:

  1. Run the following two commands in a terminal to enable local access to the X server:

    xhost +local:
    xhost
    
  2. Now run this command:

    crontab -e
    
  3. If asked to select an editor, go with /bin/nano.

  4. Go to the bottom of the file and add the following line (followed by a blank line):

    15 * * * * env DISPLAY=:0 /usr/bin/deja-dup --backup
    
  5. If you selected nano in step 2, press Ctrl+O followed by Enter and Ctrl+X. (If not, then use the appropriate commands for your editor to save the file and exit.)

You're done! Your backups will now take place 15 minutes after the start of each hour (12:15, 1:15, etc.)

Nathan Osman
  • 32,155
  • On Ubuntu 16.04, it was not necessary to enable access to xhost for local: But I did have to type the command dconf write /org/gnome/deja-dup/file/type "'normal'" to avoid the "Backup location not available" error (see http://askubuntu.com/questions/254623/running-deja-dup-as-cronjob-bu-disc-not-connected) – max Oct 15 '16 at 11:06
3

Wanted to follow up on user103965's comment. This appears to be because when started from Cron, the process doesn't know about your dconf settings. From this page: https://stackoverflow.com/questions/10374520/gsettings-with-cron I was able to create a script that can be called from cron.

#!/bin/bash
export DISPLAY=:0
sessionfile=`find "${HOME}/.dbus/session-bus/" -type f`
export `grep "DBUS_SESSION_BUS_ADDRESS" "${sessionfile}" | sed '/^#/d'`
/usr/bin/deja-dup --backup --auto

my crontab:

*/15 * * * *  /home/useracct/bin/cronBackup
-3

you can write a simple script such as

    for i in `seq 1000`
    do
        deja-dup --backup
        sleep 20  # define the frequency of backup here
    done

then run the script in background. You can use infinite loop if you want.

qkhhly
  • 117