Skip to content

Commit

Permalink
Extra dir backed up, also better description
Browse files Browse the repository at this point in the history
  • Loading branch information
kordwarshuis committed Oct 6, 2023
1 parent a0c7499 commit 5617e66
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions search-index-typesense/backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
# Author: Kor Dwarshuis
# Created: 2023-08-11
# Updated: -
# Description: This script backups three directories from the search-index-typesense directory to a timestamped directory in the KERISSE_BACKUPS_DIR directory. It also empties the original directories. The name of the directory containing the backups is the timestamp of the backup.

# Logger generates a log file with a timestamp and from which file the message comes from.
source ./search-index-typesense/logger.sh
# Description: This script backups directories related to scraping and indexing in Typesense to a timestamped directory in the KERISSE_BACKUPS_DIR directory. The name of the directory containing the backups is the timestamp of the backup.

# Load environment variables from .env file
source .env

# Logger generates a log file with a timestamp and from which file the message comes from.
source ./${SEARCH_INDEX_DIR}/logger.sh

# Check if KERISSE_BACKUPS_DIR is set
if [ -z "$KERISSE_BACKUPS_DIR" ]; then
setLogFile "error.log"
Expand All @@ -28,13 +28,10 @@ BACKUP_DIR="${KERISSE_BACKUPS_DIR}${TIMESTAMP}"
mkdir -p "$BACKUP_DIR"

# List of directories to backup
declare -a dirsToBackup=("logs" "search-index-entries" "sitemaps")

# Base directory
BASE_DIR="search-index-typesense"
declare -a dirsToBackup=("${SEARCH_INDEX_DIR}/logs" "${SEARCH_INDEX_DIR}/search-index-entries" "${SEARCH_INDEX_DIR}/sitemaps" "docs/${OVERVIEW_DIR}")

for dir in "${dirsToBackup[@]}"; do
SOURCE_DIR="${BASE_DIR}/${dir}"
SOURCE_DIR="${dir}"
if [ -d "$SOURCE_DIR" ]; then
# Copy directory to backup location
cp -r "$SOURCE_DIR" "$BACKUP_DIR"
Expand Down

0 comments on commit 5617e66

Please sign in to comment.