Created
February 24, 2024 15:48
-
-
Save Flipez/6e4ecc376a5189ed59dcc6b78fffa338 to your computer and use it in GitHub Desktop.
compress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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