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

Move in progress detection to separate file with pid #145

Merged
merged 3 commits into from Oct 9, 2015

Conversation

dbussink
Copy link
Contributor

This changes the logic of detecting if a backup is in progress by writing out the snapshot and PID of the process making the backup. This improves the situation where a previous backup was killed in a non-clean way. Clean failures in the sense of a proper exit (also non 0 exit statuses) or using ctrl-c was already handled by traps.

This just removes the in-progress file if the process is no longer running after the backup. It then cleans up the in-progress file and lets the rest of the system clean up the failed backup.

Fixes #99

cc @github/enterprise-infrastructure

This changes the logic of detecting if a backup is in progress by
writing out the snapshot and PID of the process making the backup. This
improves the situation where a previous backup was killed in a non-clean
way. Clean failures in the sense of a proper exit (also non 0 exit
statuses) or using ctrl-c was already handled by traps.

This just removes the in-progress file if the process is no longer
running after the backup. It then cleans up the in-progress file and
lets the rest of the system clean up the failed backup.

Fixes #99
snapshot="$(readlink ../in-progress)"
echo "Error: backup of $GHE_HOSTNAME already in progress in snapshot $snapshot. Aborting." 1>&2
if [ -h ../in-progress ]; then
echo "Error: in progress backup from previous version detected." 1>&2

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can improve the error message. Was there a reason to drop $GHE_HOSTNAME from it?

How about:

Error: detected a backup of $GHE_HOSTNAME already in progress.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment seems outdated based on the additional feedback, so going with the last mentioned suggestion.

@michaeltwofish
Copy link

I've left some comments on the error copy, but the functional changes make sense to me.

@dbussink
Copy link
Contributor Author

dbussink commented Oct 1, 2015

@michaeltwofish Updated the wording with your suggestion, thanks!

@lildude
Copy link
Member

lildude commented Oct 9, 2015

👍 looks good to me.

dbussink added a commit that referenced this pull request Oct 9, 2015
Move in progress detection to separate file with pid
@dbussink dbussink merged commit 8a5e488 into master Oct 9, 2015
@dbussink dbussink deleted the dbussink/failed-backup-alert branch October 9, 2015 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants