joeyates / imap-backup

Backup and Migrate IMAP Email Accounts
MIT License
1.33k stars 74 forks source link

No error code #163

Closed Rudiberto closed 11 months ago

Rudiberto commented 11 months ago

Hello Joey, at first, a big thank you for your work. I like imap-backup a lot. Now coming to my issue: I'm using imap-backup in a script, and today I saw, that for quite a time, for one of the accounts the backup hasn't been made due to a password error. I wrote a little code line to be informed about any issue that may happen: if [ "$?" -ne "0" ]; then WRONG="ERROR -> $?" ; fi These code line creates the variable which would be sent to me in a message, if any other result than 0 occurs. But it never happened, because imap-backup always sends the error code 0 if it comes to an end, even when one of the accounts has not been copied due to an error. My question is now: is there a way to get an error if anything went wrong, to not use the "W" at the beginning of your message lines to accomplish this? Sorry in advance, if there is a simple solution, but I really did not find anything.

joeyates commented 11 months ago

Hi @Rudiberto

You make a valuable point!

Previously, when a single backup failed, the whole program failed with an error. Recently, this was changed so that all backups would be attempted. The problem is that there is no external way of knowing that something failed.

I think the best thing is to change the end-of-program behaviour as follows:

I've put it on my TODO list!

Rudiberto commented 11 months ago

Fun fact is, that me by myself asked for the new behavior! Perhaps the errors could be counted and output as an error summary.

joeyates commented 11 months ago

This is included in the latest release.