Get the exit status of duplicity

Asked by Henrik

I'm writing a shell script to handle the backup of one of our servers. I'm creating an error_handler that I want to call when a duplicity call fails or crashes, but I'm unable to find this out by checking the exit status of a duplicity run since it always seems to return 0. If it succeeds, if it fails because of incorrect params, if it crashes / throws an exception during execution, it always returns 0.

The way I'm currently trying to check this is by doing,

duplicity --force /root $REMOTE/$REMOTEBASEDIR/root
if [ $? != 0 ]; then
..

$? is always 0. How can I see if it has failed/crashed?

Thanks in advance!

Question information

Language:
English Edit question
Status:
Solved
For:
Duplicity Edit question
Assignee:
No assignee Edit question
Solved by:
Henrik
Solved:
Last query:
Last reply:
Revision history for this message
edso (ed.so) said :
#1

On 10.05.2013 14:06, Henrik wrote:
> New question #228587 on Duplicity:
> https://answers.launchpad.net/duplicity/+question/228587
>
> I'm writing a shell script to handle the backup of one of our servers. I'm creating an error_handler that I want to call when a duplicity call fails or crashes, but I'm unable to find this out by checking the exit status of a duplicity run since it always seems to return 0. If it succeeds, if it fails because of incorrect params, if it crashes / throws an exception during execution, it always returns 0.
>
> The way I'm currently trying to check this is by doing,
>
> duplicity --force /root $REMOTE/$REMOTEBASEDIR/root
> if [ $? != 0 ]; then
> ..
>
> $? is always 0. How can I see if it has failed/crashed?
>

what's your duplicity version?

can you give an example with console output where duplicity fails with a success exit code (0) ?

..ede/duply.net

Revision history for this message
Henrik (g-henrik) said :
#2

Hmm I realized I was checking it the wrong way.. it actually works. I guess I had to write you that question in order to think about the correct way :) Sorry for waisting your time.