Skip to content

Remove -o option from ps use - #341

Merged
mgriffin merged 2 commits into
masterfrom
mgriffin/pserror
Oct 3, 2017
Merged

Remove -o option from ps use#341
mgriffin merged 2 commits into
masterfrom
mgriffin/pserror

Conversation

@mgriffin

Copy link
Copy Markdown
Contributor

Similar to #260, this is another instance where ps uses the -o flag. This PR follows the same fix as before and redirects any error to /dev/null.

/cc @github/backup-utils

Comment thread bin/ghe-backup Outdated
snapshot=$(echo "$progress" | cut -d ' ' -f 1)
pid=$(echo "$progress" | cut -d ' ' -f 2)
if ! ps -p $pid -o command= | grep ghe-backup; then
if ! ps -p $pid -o command= 2>/dev/null | grep ghe-backup; then

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It'd be good if we could still provide protection against multiple simultaneous backups to those who lack -o support.

As an alternative, could we drop the use of -o altogether?

if ! ps -p $pid | grep ghe-backup; then

@mgriffin

mgriffin commented Oct 3, 2017

Copy link
Copy Markdown
Contributor Author

@snh I've removed the -o flag, what do you think now?

@snh snh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good! I ran some quick tests on a Stretch box running this branch and it behaved as expected when an existing backup was still underway as well as when the in-progress file was stale.

@mgriffin
mgriffin merged commit 7a7e1c3 into master Oct 3, 2017
@mgriffin
mgriffin deleted the mgriffin/pserror branch October 3, 2017 15:52
@lildude lildude added the bug label Oct 5, 2017
@lildude lildude changed the title Ignore another error from ps Remove -o option from ps use Oct 5, 2017
@lildude lildude mentioned this pull request Oct 5, 2017
pluehne pushed a commit to pluehne/backup-utils that referenced this pull request Aug 8, 2023
Remove ghe-prune-snapshots from ghe-backup so it can be called separately. 
Incremental logic handling to be done outside of this PR.
@bonsohi bonsohi mentioned this pull request Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants