zertrin / duplicity-backup.sh

Bash wrapper script for automated backups with duplicity supporting Amazon's S3 online storage as well as other storage destinations (ftp, rsync, sftp, local storage...).
https://zertrin.org/projects/duplicity-backup/
GNU General Public License v3.0
767 stars 187 forks source link

Backup fails with code 0 and empty logs #25

Closed steadicat closed 11 years ago

steadicat commented 11 years ago

My backups have been failing silently (returning a code 0, which should mean success). My monitoring scripts have failed to alert me (because of the code 0), and I didn't get any email (probably because I don't have mailx, mail, or ssmtp). In the logs it says "Current Remote Backup File Size: s3cmd not installed.". I have s3cmd installed, so that's not the issue.

I see three issues here:

  1. Backups should never fail with a code 0.
  2. The "s3cmd not installed" message is wrong, or at least not very helpful in debugging the real issue.
  3. The default mail command setting should be something that is typically installed by default (e.g. sendmail).
zertrin commented 11 years ago

Hi,

To begin, the presence or absence of s3cmd does not usually affect the success or failure of backup, as it's only used to show remote used space in the logs. So if you say your backups failed, the root cause is likely yet to be found.

Concerning exiting with 0 code, you should check if it is actually the script that fail somewhere or if it comes from somewhere else (did you manage to perform backup directly with duplicity using the command issued in logs by the script when run in debug mode? ("-n" option))

Finally, it's always hazardous to presume what is "typically" available on a system. Anyway you're welcome if you want to propose a patch to add support for sendmail if you need it :)

Regards

Am 27.10.2012 um 18:37 schrieb "Stefano J. Attardi" notifications@github.com:

My backups have been failing silently (returning a code 0, which should mean success). My monitoring scripts have failed to alert me (because of the code 0), and I didn't get any email (probably because I don't have mailx, mail, or ssmtp). In the logs it says "Current Remote Backup File Size: s3cmd not installed.". I have s3cmd installed, so that's not the issue.

I see three issues here:

Backups should never fail with a code 0. The "s3cmd not installed" message is wrong, or at least not very helpful in debugging the real issue. The default mail command setting should be something that is typically installed by default (e.g. sendmail). — Reply to this email directly or view it on GitHub.

steadicat commented 11 years ago

Hi,

Thanks for your help. Point taken about sendmail.

It's still curious however that I'm getting code 0, with nothing useful in the logs, yet there is no backup (as verified by ./duplicity-backup.sh -s). I can verify that the script runs because a new log file is created, with this content:

--------    START DUPLICITY-BACKUP SCRIPT    --------

Attempting to acquire lock /var/log/duplicity/backup.lock
successfully acquired lock.
--------    END    --------

--------    END DUPLICITY-BACKUP SCRIPT    --------

Removing lock. Exit code: 0

For what it's worth, the backup succeeds when I initiate it manually. It's failing when started from cron (as root). Any ideas?

zertrin commented 11 years ago

Sorry for late response, crazy busy week beginning...

Could you give more information on the environment (shell, Linux distro, permissions, who is launching the script).

What does which s3cmd give as output when launched from root and then from the user that launch the script usually.

What is the command issued in the log when setting the ECHO setting (or giving -n as parameter) ? (with any personal information removed of course).

May you paste your actual configuration file (with all personal infos/credentials removed) to some pastebin of your choice?

Without these informations, there's little I can do to help you ;)

steadicat commented 11 years ago

I really appreciate your help. However, I don't want to waste your time debugging my specific setup. I think it would be more helpful to other people using this project if we instead focused on making it easier for people like me to figure out what's going wrong on their own.

Right now the script is running, printing nothing useful in the logs, and exiting with code 0. Yet the backup does not exist. IMO, that should never happen. Especially for something so critical as a backup script.

If I set the ECHO setting, I get this when I test the script: "TEST RUN ONLY: Check the logfile for command output.". Which doesn't sound like what I want. I want the backup script to run as normal but print more verbose logging. Does that make sense? Is there a way for me to do that?

zertrin commented 11 years ago

If I set the ECHO setting, I get this when I test the script: "TEST RUN ONLY: Check the logfile for command output.". Which doesn't sound like what I want. I want the backup script to run as normal but print more verbose logging. Does that make sense? Is there a way for me to do that?

Did you look in the logfile to see which command was printed?

About the way for you to do what you think would be useful for you, I can only suggest you to contribute by patching the script to achieve your will.

Fact is on my side that the script works like a charm and my log files are full of content... Unless we can understand why that isn't the case for you, I won't be able to do much more: can't fix something that doesn't seem broken to me...

zertrin commented 11 years ago

Do you still have this problem? As said, without more information I don't know where to look to fix something... I just tried again a few times using Amazon S3 backend with s3cmd installed, and everything is working fine for me...

EDIT: here is my logfile full of contents for example: http://zerobin.zertrin.org/?537644c62b080321#VYtZZqUFg5FaX1gpaLAADzyj0iApOaAu6Qp57xghXD8=

zertrin commented 11 years ago

Hi @steadicat ,

If you don't have the problem anymore or don't answer here until next week, I'll close the issue.

If you still have the problem, please give the aforementioned information to help me find the cause of your problem.

Another suggestion, run the script giving the path to your actual config file explicitly ./duplicity-backup.sh -c /path/to/your/config/file -s

zertrin commented 11 years ago

As said before, I close this issue as there's nothing I can do if I don't have more information...

Feel free to reopen it if needed.