Skip to content

Commit 19fd6df

Browse files
authored
Merge pull request #435 from github/taz/fix-simultaneous-ghe-backups
Improve multi-platform detection of simultaneous ghe-backup runs
2 parents c7cf2f2 + 47e1762 commit 19fd6df

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

bin/ghe-backup

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,14 @@ if [ -f ../in-progress ]; then
119119
progress=$(cat ../in-progress)
120120
snapshot=$(echo "$progress" | cut -d ' ' -f 1)
121121
pid=$(echo "$progress" | cut -d ' ' -f 2)
122-
if ! ps -p $pid | grep ghe-backup; then
122+
if ! ps -p "$pid" >/dev/null 2>&1; then
123123
# We can safely remove in-progress, ghe-prune-snapshots
124124
# will clean up the failed backup.
125125
unlink ../in-progress
126126
else
127-
echo "Error: backup process $pid of $GHE_HOSTNAME already in progress in snapshot $snapshot. Aborting." 1>&2
127+
echo "Error: A backup of $GHE_HOSTNAME may still be running on PID $pid." 1>&2
128+
echo "If PID $pid is not a process related to the backup utilities, please remove" 1>&2
129+
echo "the $GHE_DATA_DIR/in-progress file and try again." 1>&2
128130
exit 1
129131
fi
130132
fi

0 commit comments

Comments
 (0)