Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set error exit status when backup not done #39

Open
rbauduin opened this issue Apr 15, 2016 · 2 comments · May be fixed by #70
Open

set error exit status when backup not done #39

rbauduin opened this issue Apr 15, 2016 · 2 comments · May be fixed by #70

Comments

@rbauduin
Copy link

When a source does not exist, tarsnapper doesn't do the backup:
Not backing up 'mybackup', because not all given sources exist
but

echo $?
0
@miracle2k
Copy link
Owner

I think that change would make sense.

@jefft
Copy link

jefft commented Dec 28, 2021

Likewise, if the tarsnap cachedir is corrupt, then tarsnapper make returns a 0 exit code despite no backup being made.

To demonstrate, delete /var/cache/tarsnap or wherever cachedir points to in tarsnap.conf, and run tarsnapper -v make:

+ /opt/atl_manage/venv/bin/tarsnapper -o configfile /etc/backups/tarsnap.conf -o v -c /etc/backups/tarsnapper.conf -v make
Creating backup jira: jira-20211228-110450
Executing: tarsnap --configfile /etc/backups/tarsnap.conf -v -c -f jira-20211228-110450 /var/atlassian/application-data/jira/backups/hourly.0
tarsnap: Sequence number mismatch: Run --fsck^M
tarsnap: Error creating new archive^M
tarsnap: Error exit delayed from previous errors.^M
Something went wrong with backup job: 'jira'
Traceback (most recent call last):
  File "/opt/atl_manage/venv/lib/python3.8/site-packages/tarsnapper/script.py", line 391, in run
    self.backend.make(job)
  File "/opt/atl_manage/venv/lib/python3.8/site-packages/tarsnapper/script.py", line 236, in make
    self.call(*args)
  File "/opt/atl_manage/venv/lib/python3.8/site-packages/tarsnapper/script.py", line 68, in call
    return self._exec_tarsnap(call_with)
  File "/opt/atl_manage/venv/lib/python3.8/site-packages/tarsnapper/script.py", line 88, in _exec_tarsnap
    raise TarsnapError("tarsnap failed with status {0}:{1}{2}".format(
tarsnapper.script.TarsnapError: tarsnap failed with status 1:
tarsnap: Sequence number mismatch: Run --fsck^M
tarsnap: Error creating new archive^M
tarsnap: Error exit delayed from previous errors.^M

Executing: tarsnap --configfile /etc/backups/tarsnap.conf -v --list-archives
jira-20210715-020102    2021-07-15 12:01:02^M
....
19 backups are matching
0 of those can be deleted
Keeping jira-20210715-020102

kevinoconnor7 added a commit to kevinoconnor7/tarsnapper that referenced this issue Jun 18, 2023
Currently any errors coming the underlying tarsnap commands are logged. This is
not threaded back to the entrypoint of the application though, so we end up
exiting with a zero code despite one or more of the jobs having failed. This
makes monitoring the status of tarsnapper impossible. One would have to know to
regularly check its logs to ensure it's actually backing things up.

Fixes miracle2k#39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants