Skip to content

Instantly share code, notes, and snippets.

@Flipez
Created February 24, 2024 15:48
Show Gist options
  • Save Flipez/6e4ecc376a5189ed59dcc6b78fffa338 to your computer and use it in GitHub Desktop.
Save Flipez/6e4ecc376a5189ed59dcc6b78fffa338 to your computer and use it in GitHub Desktop.
compress
#!/bin/bash
set -o errexit
beforeyesterday=$(date -d '-2 day' "+%Y%m%d")
yesterday=$(date -d '-1 day' "+%Y%m%d")
###
# Created tar from the requests yesterday using zstandard compression
tar --sort=name --zstd -cf $yesterday.tar.zst $yesterday/
###
# Test tar integrity by listing its content
tar -tf $yesterday.tar.zst > /dev/null
###
# Copy compressed file into storagebox for public access
rsync -av $yesterday.tar.zst /mnt/storagebox/mvg-data/
###
# Remove the day before yesterday
rm -r $beforeyesterday/
###
# Perform healthcheckping if all previous commands succeed
curl "https://hc-ping.com/REDACTED"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment