Skip to content

Commit 0f898fb

Browse files
authored
Merge pull request #874 from github/hao/trap-int-backup-repo
trap INT for ghe-backup-repository cleanup
2 parents 49480ce + 1c56a71 commit 0f898fb

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

share/github-backup-utils/ghe-backup-repositories

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,15 @@ cleanup() {
9090

9191
# Enable remote GC operations
9292
for hostname in $hostnames; do
93-
ghe-gc-enable $ssh_config_file_opt $hostname:$port || true
93+
ghe-gc-enable $ssh_config_file_opt $hostname:$port || {
94+
echo "Re-enable gc on $hostname failed, please manually delete $SYNC_IN_PROGRESS_FILE" 1>&2
95+
}
9496
done
9597

9698
ghe-ssh "$GHE_HOSTNAME" -- rm -rf $remote_tempdir
9799
rm -rf $tempdir
98100
}
99-
trap 'cleanup' EXIT
100-
trap 'exit $?' INT # ^C always terminate
101+
trap 'cleanup' EXIT INT
101102

102103
# Disable remote GC operations
103104
for hostname in $hostnames; do

share/github-backup-utils/ghe-backup-storage

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ mkdir -p "$backup_dir"
5959
cleanup() {
6060
# Enable remote maintenance operations
6161
for hostname in $hostnames; do
62-
ghe-gc-enable $ssh_config_file_opt $hostname:$port || true
62+
ghe-gc-enable $ssh_config_file_opt $hostname:$port || {
63+
echo "Re-enable gc on $hostname failed, please manually delete $SYNC_IN_PROGRESS_FILE" 1>&2
64+
}
6365
done
6466

6567
ghe-ssh "$GHE_HOSTNAME" -- rm -rf $remote_tempdir

0 commit comments

Comments
 (0)