1

i've installed a fresh ubuntu 16.04 LTS some days ago.

I tried to setup automatic backup with deja-dup as i had on my old system (ubuntu 14.04). I used to launch deja-dup from a script, and this script was executed at a scheduled time in cron, it worked decently.

I have tried to do the same thing on the new system but for some reason it doesn't run when it is launched from cron, it says "Another backup operation is already running."

ps aux | grep deja-dup output :

user   2909  0.0  0.1 378136  6944 ?        Sl   mars16   0:00 /usr/lib/x86_64-linux-gnu/deja-dup/deja-dup-monitor
user  23785  0.0  0.0  16004  2204 pts/27   S+   10:51   0:00 grep --color=auto deja-dup

Only the monitor is running, and i'm assuming this is fine (maybe i'm wrong), i tried to kill it and run the cron again but no luck.

I installed duplicity and running a simple deja-dup --backup is working fine. I also tried to clean the .cache/deja-dup/ with no success.

Here is the script that runs from cron :

#!/bin/sh

## test for an existing bus daemon, just to be safe
if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
    ## if not found, launch a new one
    eval `dbus-launch --sh-syntax --exit-with-session`
fi

# Launch deja-dup
deja-dup --backup --display=:0

And here is the cron line :

30 20 * * * /path/to/backup_script.sh

I also tried to put a DEJA_DUP_DEBUG=1 in the backup_script.sh and redirecting the output to a text file, but it creates the file and do nothing else.

Any suggestions are welcome, thanks !

edit1 : deja-dup configuration is set to backup files to a local server with ssh.

2

For those who may encounter this problem, after reading the sources i found that this error message was related to the session bus... So i went reading the ubuntu manpage http://manpages.ubuntu.com/manpages/xenial/man1/dbus-launch.1.html and found this interesting part of the description :

You may specify a program to be run; in this case, dbus-launch will launch a session bus instance, set the appropriate environment variables so the specified program can find the bus, and then execute the specified program, with the specified arguments. See below for examples.

So i changed my script to

#!/bin/bash

# Launch deja-dup with dbus-launch to get the session bus
dbus-launch deja-dup --backup --display=:0

And it runs perfectly at the scheduled time from the cron !

  • sudo apt install dbus-x11 is required – Jonathan Aug 18 '17 at 23:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.