2024-08-04 23:10:36 +02:00
|
|
|
#!/bin/bash
|
2024-12-30 01:49:10 +01:00
|
|
|
SCRIPT_ABS_LOCATION="$(realpath "$(dirname "$0")")"
|
2024-08-04 23:10:36 +02:00
|
|
|
|
2024-12-29 15:08:09 +01:00
|
|
|
# shellcheck disable=SC1090
|
2024-12-30 01:49:10 +01:00
|
|
|
source "$SCRIPT_ABS_LOCATION/cryptpad-backup.env"; \
|
2024-12-29 15:08:09 +01:00
|
|
|
|
|
|
|
# shellcheck disable=SC1090
|
2024-12-30 01:49:10 +01:00
|
|
|
source "$SCRIPT_ABS_LOCATION/../logger.sh"; \
|
2024-08-04 23:10:36 +02:00
|
|
|
|
2024-12-30 01:49:10 +01:00
|
|
|
# shellcheck disable=SC1090
|
|
|
|
source "$SCRIPT_ABS_LOCATION/../common-backup.sh"
|
2024-08-04 23:10:36 +02:00
|
|
|
|
2024-12-29 15:08:09 +01:00
|
|
|
# shellcheck disable=SC2034
|
2024-08-04 23:10:36 +02:00
|
|
|
LOG_FILE="$SCRIPT_ABS_LOCATION/cryptpad-backup.log"
|
|
|
|
|
2024-12-30 01:49:10 +01:00
|
|
|
log "Cleaning up inactive files..."
|
|
|
|
docker exec cryptpad /usr/local/bin/node scripts/evict-inactive.js --workdir=/cryptpad || { log "Error cleaning up inactive files"; exit 1; }
|
|
|
|
|
|
|
|
log "Cleaning up archived files..."
|
|
|
|
docker exec cryptpad /usr/local/bin/node scripts/evict-archived.js --workdir=/cryptpad || { log "Error cleaning up archived files"; exit 1; }
|
|
|
|
|
|
|
|
run_duplicati_backup \
|
|
|
|
"$BACKUP_CONTAINER" \
|
|
|
|
"$BACKUP_DESTINATION" \
|
|
|
|
"cryptpad" \
|
|
|
|
7 \
|
|
|
|
"$SFTP_USERNAME" \
|
|
|
|
"$SFTP_PASSWORD" \
|
|
|
|
"$BACKUP_ENCR_PASSPHRASE" \
|
|
|
|
"$SFTP_FINGERPRINT" \
|
|
|
|
"$SOURCE_DIR/data" \
|
|
|
|
"$SOURCE_DIR/datastore" \
|
|
|
|
"$SOURCE_DIR/block" \
|
|
|
|
"$SOURCE_DIR/blob" \
|
|
|
|
"$SOURCE_DIR/config/config.js" \
|
|
|
|
"$SOURCE_DIR/customize" \
|
|
|
|
"$SOURCE_DIR/customize.dist"
|
|
|
|
|