Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions share/github-backup-utils/ghe-backup-es-audit-log
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,15 @@ fi
current_index=audit_log-$(ghe-ssh "$host" 'date +"%Y-%m"')

for index in $indices; do
if [ -f $GHE_DATA_DIR/current/audit-log/$index.gz -a $index \< $current_index ]; then
# Hard link any older indices since they are read only and won't change
if [ -f $GHE_DATA_DIR/current/audit-log/$index.gz -a -f $GHE_DATA_DIR/current/audit-log/$index.gz.complete -a $index \< $current_index ]; then
# Hard link any older indices that are complete, since these won't change
ln $GHE_DATA_DIR/current/audit-log/$index.gz $GHE_SNAPSHOT_DIR/audit-log/$index.gz
ln $GHE_DATA_DIR/current/audit-log/$index.gz.complete $GHE_SNAPSHOT_DIR/audit-log/$index.gz.complete
else
ghe-ssh "$host" "/usr/local/share/enterprise/ghe-es-dump-json \"http://localhost:$es_port/$index\"" | gzip > $GHE_SNAPSHOT_DIR/audit-log/$index.gz
if [ $index \< $current_index ]; then
touch $GHE_SNAPSHOT_DIR/audit-log/$index.gz.complete
fi
fi
done

Expand Down
11 changes: 8 additions & 3 deletions share/github-backup-utils/ghe-backup-es-hookshot
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,19 @@ ghe_remote_version_required "$host"
mkdir -p "$GHE_SNAPSHOT_DIR/hookshot"

indices=$(ghe-ssh "$host" 'curl -s "localhost:9201/_cat/indices/hookshot-logs-*"' | cut -d ' ' -f 3)

current_index=hookshot-logs-$(ghe-ssh "$host" 'date +"%Y-%m-%d"')

for index in $indices; do
if [ -f $GHE_DATA_DIR/current/hookshot/$index.gz -a $index \< $current_index ]; then
# Hard link any older indices since they are read only and won't change
if [ -f $GHE_DATA_DIR/current/hookshot/$index.gz -a -f $GHE_DATA_DIR/current/hookshot/$index.gz.complete -a $index \< $current_index ]; then
# Hard link any older indices that are complete, since these won't change
ln $GHE_DATA_DIR/current/hookshot/$index.gz $GHE_SNAPSHOT_DIR/hookshot/$index.gz
ln $GHE_DATA_DIR/current/hookshot/$index.gz.complete $GHE_SNAPSHOT_DIR/hookshot/$index.gz.complete
else
ghe-ssh "$host" "/usr/local/share/enterprise/ghe-es-dump-json 'http://localhost:9201/$index'" | gzip > $GHE_SNAPSHOT_DIR/hookshot/$index.gz
ghe-ssh "$host" "/usr/local/share/enterprise/ghe-es-dump-json \"http://localhost:9201/$index\"" | gzip > $GHE_SNAPSHOT_DIR/hookshot/$index.gz
if [ $index \< $current_index ]; then
touch $GHE_SNAPSHOT_DIR/hookshot/$index.gz.complete
fi
fi
done

Expand Down