Skip to content

Commit 31605e0

Browse files
authored
Merge pull request #518 from github/juruen/check-mysql-audit
Check snapshot contains MySQL audit log dir
2 parents 65c23c1 + f639ab7 commit 31605e0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

share/github-backup-utils/ghe-restore-mysql-audit-log

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ cleanup(){
3939
ghe-ssh "$GHE_HOSTNAME" -- "sudo rm -rf $remote_dump"
4040
}
4141

42+
# Check whether the snapshot contains any MySQL data at all
43+
is_mysql_snapshot(){
44+
test -d "$snapshot_dir"
45+
}
46+
4247
# Use ghe-export-audit-logs to fetch the current metadata for all stored
4348
# months in MySQL. For each month: number of entries, minum ID, maximum ID
4449
fetch_current_meta(){
@@ -204,6 +209,11 @@ restore(){
204209
return
205210
fi
206211

212+
if ! is_mysql_snapshot; then
213+
ghe_verbose "snapshot doesn't contain MySQL data"
214+
return
215+
fi
216+
207217
restore_schema
208218
if [ -n "$only_schema" ]; then
209219
ghe_verbose "only table schema was imported"

0 commit comments

Comments
 (0)