Skip to content

Commit 028faef

Browse files
committed
refinements to display
1 parent d2d2286 commit 028faef

File tree

4 files changed

+25
-13
lines changed

4 files changed

+25
-13
lines changed

bin/ghe-backup

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,13 @@ if ! ln -s /data/does/not/exist/hooks/ src/ >/dev/null 2>&1; then
7373
fi
7474

7575
if ! output=$(rsync -a src/ dest1 2>&1 && rsync -av src/ --link-dest=../dest1 dest2 2>&1); then
76-
log_error "Error: rsync encountered an error that could indicate a problem with permissions," 1>&2
77-
log_error "hard links, symbolic links, or another issue that may affect backups." 1>&2
76+
log_error "Error: rsync encountered an error that could indicate a problem with permissions,\n hard links, symbolic links, or another issue that may affect backups." 1>&2
7877
echo "$output"
7978
exit 1
8079
fi
8180

8281
if [ "$(ls -il dest1/testfile | awk '{ print $1 }')" != "$(ls -il dest2/testfile | awk '{ print $1 }')" ]; then
83-
log_error "Error: the filesystem containing $GHE_DATA_DIR does not support hard links." 1>&2
84-
log_error "Backup Utilities use hard links to store backup data efficiently." 1>&2
82+
log_error "Error: the filesystem containing $GHE_DATA_DIR does not support hard links.\n Backup Utilities use hard links to store backup data efficiently." 1>&2
8583
exit 1
8684
fi
8785
rm -rf src dest1 dest2
@@ -168,6 +166,9 @@ echo "$GHE_BACKUP_STRATEGY" > strategy
168166
# Create benchmark file
169167
bm_init > /dev/null
170168

169+
START_TIME=$(date +%s)
170+
log_info "Starting backup of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION"
171+
171172
ghe-backup-store-version ||
172173
log_warn "Warning: storing backup-utils version remotely failed."
173174

@@ -201,33 +202,40 @@ if ghe-ssh "$GHE_HOSTNAME" -- 'ghe-config --true app.minio.enabled'; then
201202
ghe-backup-minio 1>&3 || failures="$failures minio"
202203
fi
203204

205+
cmd_title=$(log_info "Backing up Redis database ...")
204206
commands=("
205-
echo \"Backing up Redis database ...\"
207+
echo \"$cmd_title\"
206208
ghe-backup-redis > redis.rdb || printf %s \"redis \" >> \"$failures_file\"")
207209

210+
cmd_title=$(log_info "Backing up audit log ...")
208211
commands+=("
209-
echo \"Backing up audit log ...\"
212+
echo \"$cmd_title\"
210213
ghe-backup-es-audit-log || printf %s \"audit-log \" >> \"$failures_file\"")
211214

215+
cmd_title=$(log_info "Backing up Git repositories ...")
212216
commands+=("
213-
echo \"Backing up Git repositories ...\"
217+
echo \"$cmd_title\"
214218
ghe-backup-repositories || printf %s \"repositories \" >> \"$failures_file\"")
215219

220+
cmd_title=$(log_info "Backing up GitHub Pages artifacts ...")
216221
commands+=("
217-
echo \"Backing up GitHub Pages artifacts ...\"
222+
echo \"$cmd_title\"
218223
ghe-backup-pages || printf %s \"pages \" >> \"$failures_file\"")
219224

225+
cmd_title=$(log_info "Backing up storage data ...")
220226
commands+=("
221-
echo \"Backing up storage data ...\"
227+
echo \"$cmd_title\"
222228
ghe-backup-storage || printf %s \"storage \" >> \"$failures_file\"")
223229

230+
cmd_title=$(log_info "Backing up custom Git hooks ...")
224231
commands+=("
225-
echo \"Backing up custom Git hooks ...\"
232+
echo \"$cmd_title\"
226233
ghe-backup-git-hooks || printf %s \"git-hooks \" >> \"$failures_file\"")
227234

228235
if [ "$GHE_BACKUP_STRATEGY" = "rsync" ]; then
236+
cmd_title=$(log_info "Backing up Elasticsearch indices ...")
229237
commands+=("
230-
echo \"Backing up Elasticsearch indices ...\"
238+
echo \"$cmd_title\"
231239
ghe-backup-es-rsync || printf %s \"elasticsearch \" >> \"$failures_file\"")
232240
fi
233241

@@ -277,6 +285,9 @@ fi
277285
log_info "Checking for leaked ssh keys ..."
278286
ghe-detect-leaked-ssh-keys -s "$GHE_SNAPSHOT_DIR" || true
279287

288+
END_TIME=$(date +%s)
289+
log_info "Runtime: $((${END_TIME} - ${START_TIME})) seconds"
290+
log_info "Backup of $GHE_HOSTNAME finished."
280291
# Make sure we exit zero after the conditional
281292
true
282293

bin/ghe-restore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ fi
266266

267267
# Log restore start message locally and in /var/log/syslog on remote instance
268268
START_TIME=$(date +%s)
269-
echo "Starting restore of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION from snapshot $GHE_RESTORE_SNAPSHOT"
269+
log_info "Starting restore of $GHE_HOSTNAME with backup-utils v$BACKUP_UTILS_VERSION from snapshot $GHE_RESTORE_SNAPSHOT"
270270
ghe_remote_logger "Starting restore from $(hostname) with backup-utils v$BACKUP_UTILS_VERSION / snapshot $GHE_RESTORE_SNAPSHOT ..."
271271
# Create an in-progress-restore file to prevent simultaneous backup or restore runs
272272
echo "${START_TIME} $$" > ${GHE_DATA_DIR}/in-progress-restore

share/github-backup-utils/ghe-backup-config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ if [ -n "$GHE_VERBOSE" ]; then
193193
if [ "$TERM" = "dumb" ] || [[ "$OUTPUT_COLOR" != "yes" ]]; then
194194
exec 3> >(echo -e "$date_format INFO $calling_script_name: $*" >>"$GHE_VERBOSE_LOG")
195195
else
196+
# colorize the input if supported.
196197
display_info=" ${GREEN}INFO${NC} "
197198
display_caller="${BLUE}$calling_script_name${NC}"
198199
exec 3> >(echo -e "$date_format $display_info $display_caller: $*" >>"$GHE_VERBOSE_LOG")

share/github-backup-utils/ghe-restore-git-hooks

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ if [ -d "$GHE_DATA_DIR/$GHE_RESTORE_SNAPSHOT/git-hooks/environments/tarballs" ];
6060

6161
if [ -n "$hostname" ]; then
6262
ghe-ssh $ssh_config_file_opt -l $user "$hostname:122" -- "sudo -u git mkdir -p $GHE_REMOTE_DATA_USER_DIR/git-hooks/environments/tarballs"
63-
log_rsync "BEGIN: git-hooksi tarball rsync" 1>&3
63+
log_rsync "BEGIN: git-hooks tarball rsync" 1>&3
6464
ghe-rsync -avH --delete \
6565
-e "ssh -q $opts -p $port $ssh_config_file_opt -l $user" \
6666
--rsync-path="sudo -u git rsync" \

0 commit comments

Comments
 (0)